Announcement Announcement Module
No announcement yet.
How to use separate connections for sending and receiving data in Spring-AMQP? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use separate connections for sending and receiving data in Spring-AMQP?

    While exploring flow-control in RabbitMQ, I found this:

    The intent here is to introduce a flow control mechanism that throttles producers but lets consumers continue unaffected. However, since AMQP permits producers and consumers to operate on the same channel, and on different channels of a single connection, this logic is necessarily imperfect. In practice that does not pose any problems for most applications since the throttling is observable merely as a delay. Nevertheless, other design considerations permitting, it is advisable to only use individual AMQP connections for either producing or consuming.

    I am using Spring Integration in my web-application to send/receive data to/from RabbitMQ broker. I declare connection-factory, amqp-template, rabbit-admin, channels and inbound/outbound adapters using XML. What is the recommended way to ensure separate connections are used for sending and receiving? My observation is that by default, both sending and receiving are done on the same connection but on different channels.

  • #2
    Currently, all users of the same connection factory share a connection; this may change in the future (optionally) but, for now, if you want to use a different connection, you will need to declare a separate ConnectionFactory for each of the inbound and outbound adapters/templates.