I need to consume messages from Rabbit HA cluster via HAProxy so I switched to CacheMode.CONNECTION as it is recommended in spring-amqp-documentation. Moreover I need to consume messages from many queues so I create for each queue SimpleMessageListenerContainer with 4 concurrent consumers and I have few questions:
- After few tests it looks that my approach is not efficient because each time when a new queue is added also new SimpleMessageListenerContainer is created with 4 threads. So I could set more queues for the given
SimpleMessageListenerContainerwhat looks more efficient but maybe there is another better way? - Why when I have switched to
CacheMode.CONNECTIONfor each consumer inSimpleMessageListenerContaineris created new connection? Can I set in some way one connection for all consumers in a givenSimpleMessageListenerContaineror maybe it is not recommended? How to handle exception
"org.springframework.amqp.rabbit.connection.AutoRecoverConnectionNotCurrentlyOpenException: Auto recovery connection is not currently open"
I received it when one RabbitMQ node is down. Even when node is up again
SimpleMessageListenerContainercannot reconnect.
Thanks in advance for help.