Search code examples
spring-bootspring-amqpspring-rabbitspring-cloud-config

Can we change rabbitmq properties spring config and stream rabbit


In my POC, I am using Spring Cloud Config and Spring Stream Rabbit. I want to dynamically change number of listeners (concurrency). Is it possible to do that? I want to do following:

1) If there are too many messages in queue, i want to increase concurrency level.

2) In scenario where my downstream system is not available, I want to stop processing messages from queue (in short concurrency level 0).

How i can achieve this?

Thanks for help.


Solution

  • The listener container running in the binder supports such changes (although you can't go down to 0, but the container can be stop() ped).

    However, spring-cloud-stream provides no mechanism for you to get a reference to the listener container.

    You might want to consider using a @RabbitListener from Spring AMQP instead - it will give you complete control over the listener container.