Send message to arbitrary vhost / exchange with RabbitMQ / Spring AMQP

我怕爱的太早我们不能终老 提交于 2020-06-16 09:49:06

问题


I use RabbitMQ and Spring AMQP to send messages.

I have this snippet:

rabbitTemplate.convertAndSend(exchange, key, object);

This works when I operate on a single VHOST.


I have to receive messages from 1 queue and resend them to N exchanges (on many different VHOSTs). How can I do it in Spring AMQP (ver 1.2)?

Is there anything better than manually defined <rabbit:connection-factory> (for each VHOST) and related elements in my xml context?


回答1:


We added support for that in 1.3. See Routing Connection Factory in the reference manual.

It's not arbitrary, but you can update the map at any time to add new targets.



来源:https://stackoverflow.com/questions/23386689/send-message-to-arbitrary-vhost-exchange-with-rabbitmq-spring-amqp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!