Search code examples
springamqpspring-amqp

spring amqp sendAndReceive with multiple queue


I'm using spring amqp and I'd like to know if there is a way to invoke a RabbitTemplate.sendAndReceive on a fanout exchange and get a list of answers (one for each queue bound to the chosen exchange)

Thanks in advance for the help.


Solution

  • No; that's not currently supported.

    One problem I can see is that the template wouldn't know how many replies to expect (without introspecting the exchange first, and even then, the topology might change in the interim).

    You could use Spring Integration (send via an outbound-channel-adapter) and receive the replies on an inbound-channel-adapter and use an aggregator to group the replies (with some release strategy - either count or time-based).