Implementing publish/subscribe with RabbitMQ
In the following section, you will learn how to implement a basic publish/subscribe architecture. For this, we will take a look at the Advanced Message Queueing Protocol (AMQP) and one of its most popular implementations, RabbitMQ.
The Advanced Message Queueing Protocol
On a protocol level, RabbitMQ implements the AMQP. Before getting started with RabbitMQ, let's get started by taking a look at the basic protocol semantics of AMQP.
An AMQP message broker manages two basic kinds of resources—Exchanges and Queues. Each publisher publishes its messages into an exchange. Each subscriber consumes a queue. The AMQP broker is responsible for putting the messages that are published in an exchange into the respective queue. Where messages go after they have been published to an exchange depends on the exchange type and the routing rules called bindings. AMQP knows three different types of exchanges:
- Direct exchanges: Messages are published with a given topic...