问题
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 VHOST
s).
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