...

/

Pipelines and Competing Consumers in AMQP

Pipelines and Competing Consumers in AMQP

Learn how to distribute tasks to a set of remote workers using RabbitMQ and AMQP.

Point-to-point communications and competing consumers

In a peer-to-peer configuration, a pipeline is a very straightforward concept to imagine. With a message broker in the middle, though, the relationships between the various nodes of the system are a little bit harder to understand: the broker itself acts as an intermediary for our communications and, often, we don’t really know who is on the other side listening for messages. For example, when we send a message using AMQP, we don’t deliver it to its destination directly, but instead to an exchange and then to a queue. Finally, it’ll be for the broker to decide where to route the message, based on the rules defined in the exchange, the bindings, and the destination queues.

If we want to implement a pipeline and a task distribution pattern using a system like AMQP, we have to make sure that each message is received by only one consumer, but this is impossible to guarantee if an exchange can potentially be bound to more than one queue. The solution, ...