4.5. Exchange Subscription Patterns

There are three different patterns for subscribing to an Exchange:
  1. copy of messages
  2. move of messages
  3. exclusive binding
Copy of Messages

A copy of messages is where each consumer gets their own copy of every message.

Note

This approach is also known as a publish-subscribe pattern, ephemeral or private subscription.
This case creates and binds a temporary private queue that is destroyed when your application disconnects. This approach makes sense when you do not need to share responsibility for the messages between multiple consumers, and you do not care about messages that are sent when your application is not running or is disconnected.
This arrangement makes sense, for example, when a service is logging activity based on messages, or when multiple consumers want notification of events.
Move of Messages

A move of messages is where multiple consumers connect to the same queue and take messages from the queue in a round-robin fashion.

Note

This approach is also known as a Shared Queue.
If consumer A and consumer B are accessing the same shared queue, then consumer A will not see the messages that consumer B takes from the queue. This arrangement makes sense, for example, in a scenario where worker nodes are dispatching jobs from a work queue. You want one node only to see each message.
This allows messages to be buffered in the queue when your application is disconnected, and allows several consumers to share responsibility for the messages in the queue.
This arrangement makes sense, for example, in a scenario where worker nodes are dispatching jobs from a work queue. You want one node only to see each message.
These two patterns are not mutually exclusive - for example, three worker nodes could share a queue in round-robin fashion while another process gets its own copy of the messages in the queue to create an archive.
Exclusive Binding

The third pattern, exclusive binding, is where a consumer mandates that only the consumer may have access to messages routed to an endpoint.

Note

Exclusive binding is not supported by AMQP 1.0