Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleRabbitListenerContainerFactory consumer disappeared #1531

Open
Tancen opened this issue Nov 9, 2022 · 2 comments
Open

SimpleRabbitListenerContainerFactory consumer disappeared #1531

Tancen opened this issue Nov 9, 2022 · 2 comments

Comments

@Tancen
Copy link

Tancen commented Nov 9, 2022

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();
    ...
@garyrussell
Copy link
Contributor

It is impossible to help diagnose such a problem with just stack traces; you need to provide logs too.

Also, your information is incorrect; the first dump does contain cooked.eigenvalue and raw.realtime, but the second does not.

This is unlikely a problem with the framework; perhaps something stopped those containers.

@Tancen
Copy link
Author

Tancen commented Nov 10, 2022

It is impossible to help diagnose such a problem with just stack traces; you need to provide logs too.

Also, your information is incorrect; the first dump does contain cooked.eigenvalue and raw.realtime, but the second does not.

This is unlikely a problem with the framework; perhaps something stopped those containers.

I can't search for any text about 'cooked.eigenvalue' in the file 'stack-snapshoot-1.txt', are you looking in the file 'stack-snapshoot-2.txt'?
image

We removed the log files before this posting, So, I can't for you the log files.
Since each consumer is a thread, so each consumer should have a corresponding thread. From 'stack-snapshoot-1.txt', it is not guaranteed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants