-
Notifications
You must be signed in to change notification settings - Fork 642
Description
RabbitMQ Version: RabbitMQ 3.11.0
spring-amqp Version: 2.2.2 RLEASE
springboot Version: 2.2.2 RLEASE
OS Version: Ubuntu 20.04-Server LTS
I discovered a lot of messages in two queues ('MeasuringMessageConsumer.raw.realtime' and 'MeasuringMessageConsumer.cooked.eigenvalue') that can't consume from our RabbitMQ server in the morning today. Further, on the RabbitMQ management web page, the number of consumers is zero in the two queues(1. The number of consumers in the other queues is not zero. 2. The consumer-application was running.).
To figure it out I made a snapshot of the application stack and output to the file stack-snapshoot-1.txt . After that, I restarted the application, made a snapshot again, and output to the file stack-snapshoot-2.txt.
In the file 'stack-snapshoot-1.txt', without any text 'MeasuringMessageConsumer.raw.realtime' or 'MeasuringMessageConsumer.cooked.eigenvalue', But 'stack-snapshoot-2.txt' does.
Key codes:
...
static final String RABBIT_LISTENER_ID_RAW_REALTIME = "MeasuringMessageConsumer.raw.realtime";
...
@Bean(name = "customFactory")
RabbitListenerContainerFactory getFactory(ConnectionFactory connectionFactory)
{
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
factory.setPrefetchCount(prefetchCount);
factory.setBatchSize(batchSize);
factory.setConsumerBatchEnabled(true);
factory.setBatchListener(true);
factory.setMaxConcurrentConsumers(8);
factory.setConcurrentConsumers(4);
factory.setAcknowledgeMode(AcknowledgeMode.AUTO);
return factory;
}
...
@RabbitListener(
id = RABBIT_LISTENER_ID_RAW_REALTIME,
queuesToDeclare = {@Queue(value="${rabbitMQ.consumer.queues.raw.realtime}",durable = "true")},
autoStartup = "false",
containerFactory = "customFactory"
)
@RabbitHandler
public void handleRawRealtimeMessage(List<String> messages)
{
...
}
...
registry.getListenerContainer(RABBIT_LISTENER_ID_RAW_REALTIME).start();
...