简体   繁体   中英

Adding multiple listener-container, with ids, does not seem to work

I have a rabbitMQ configuration where in I need to have two separate listener-containers, each having a set of listeners. Here is a snippet from rabbitmq-context.xml:

<rabbit:listener-container
connection-factory="connectionFactory" message-converter="jsonMessageConverter" 
auto-startup="true" 
acknowledge="manual"
requeue-rejected="true"
concurrency="5"
task-executor="myTaskExecutor" >
       <rabbit:listener queues="Queue1" ref="myQ1Listener" method="onMessage"/>
</rabbit:listener-container>

<rabbit:listener-container
connection-factory="connectionFactory" message-converter="jsonMessageConverter" 
auto-startup="true" 
acknowledge="manual"
requeue-rejected="false"
concurrency="5"
task-executor="myTaskExecutor" >
       <rabbit:listener queues="Queu2" ref="myQ2Listener" method="onMessage"/>
</rabbit:listener-container>

If these are specified without an id all the listeners are started on initialization.

If I go ahead and specify an id to one of them (which I want to reference in another bean), the other listener-container (without the id) does not get initialized.

If I specify ids with both these listener-containers (and do not reference those ids anywhere), still listeners from only one of the listener-containers are initialized.

Can anybody help me understand if there its a configuration issue or is this a bug in RabbitMQ?

This issue has been fixed ( https://jira.spring.io/browse/AMQP-332 ) according to SO question Adding multiple listeners which will listen to different RabbitMQ queue not working .

So, show, please, the wrong config and try to upgrade to te latest Spring AMQP version.

Acutally we have similar test-case . I've just removed the id from nexted <rabbit:listener> elements and the ListenFromAutoDeleteQueueTests passed.

Please, check versions of Spring jars and try to use the latests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM