How to set certain number of listener on one server and no listener on other server for same queue in spring amqp as we can not set 0 concurrency?

StackOverflow https://stackoverflow.com/questions/23557393

  •  18-07-2023
  •  | 
  •  

Question

I have setup listeners on reply queues, I want those to be only on master (from where messages are queued) and other servers should have no listeners to reply queue. They should have listeners to all other queues.

Spring AMQP doesn't allow to set listener concurrency to be set to 0. So I cant set 0 listners to reply queue on slave servers.

How do I set 0 concurrency on slave servers for reply queues ?

Was it helpful?

Solution

I could do it using spring profiles. I just added "master" profile to all listener beans and activated master profile only on master server.

Few nice articles to begin with using profiles

http://diarmuidmoloney.wordpress.com/2012/04/07/spring-environments/

http://maciejwalkowiak.pl/blog/2012/03/27/spring-3-1-profiles-and-tomcat-configuration/

OTHER TIPS

Use auto-startup="false" and only start() the container that you want to listen.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top