void cancelConsumer(final String eventMessage) { publishConsumerFailedEvent(eventMessage, true, null); synchronized (DirectMessageListenerContainer.this.consumersMonitor) { List<SimpleConsumer> list = DirectMessageListenerContainer.this.consumersByQueue.get(this.queue); if (list != null) { list.remove(this); } DirectMessageListenerContainer.this.consumers.remove(this); addConsumerToRestart(this); } finalizeConsumer(); }
void cancelConsumer(final String eventMessage) { publishConsumerFailedEvent(eventMessage, true, null); synchronized (DirectMessageListenerContainer.this.consumersMonitor) { List<SimpleConsumer> list = DirectMessageListenerContainer.this.consumersByQueue.get(this.queue); if (list != null) { list.remove(this); } DirectMessageListenerContainer.this.consumers.remove(this); addConsumerToRestart(this); } finalizeConsumer(); }
@Nullable private SimpleConsumer handleConsumeException(String queue, SimpleConsumer consumerArg, Exception e) { SimpleConsumer consumer = consumerArg; if (e.getCause() instanceof ShutdownSignalException && e.getCause().getMessage().contains("in exclusive use")) { getExclusiveConsumerExceptionLogger().log(logger, "Exclusive consumer failure", e.getCause()); publishConsumerFailedEvent("Consumer raised exception, attempting restart", false, e); } else if (e.getCause() instanceof ShutdownSignalException && RabbitUtils.isPassiveDeclarationChannelClose((ShutdownSignalException) e.getCause())) { this.logger.error("Queue not present, scheduling consumer " + (consumer == null ? "for queue " + queue : consumer) + " for restart", e); } else if (this.logger.isWarnEnabled()) { this.logger.warn("basicConsume failed, scheduling consumer " + (consumer == null ? "for queue " + queue : consumer) + " for restart", e); } if (consumer == null) { addConsumerToRestart(new SimpleConsumer(null, null, queue)); } else { addConsumerToRestart(consumer); consumer = null; } return consumer; }
@Nullable private SimpleConsumer handleConsumeException(String queue, SimpleConsumer consumerArg, Exception e) { SimpleConsumer consumer = consumerArg; if (e.getCause() instanceof ShutdownSignalException && e.getCause().getMessage().contains("in exclusive use")) { getExclusiveConsumerExceptionLogger().log(logger, "Exclusive consumer failure", e.getCause()); publishConsumerFailedEvent("Consumer raised exception, attempting restart", false, e); } else if (e.getCause() instanceof ShutdownSignalException && RabbitUtils.isPassiveDeclarationChannelClose((ShutdownSignalException) e.getCause())) { this.logger.error("Queue not present, scheduling consumer " + (consumer == null ? "for queue " + queue : consumer) + " for restart", e); } else if (this.logger.isWarnEnabled()) { this.logger.warn("basicConsume failed, scheduling consumer " + (consumer == null ? "for queue " + queue : consumer) + " for restart", e); } if (consumer == null) { addConsumerToRestart(new SimpleConsumer(null, null, queue)); } else { addConsumerToRestart(consumer); consumer = null; } return consumer; }