Recently, a colleague and I were looking into RabbitMQ and the different types of exchanges, how they work with bindings and queues, etc.
One thing that took us some time to grasp is the different types of exchanges, so for a general introduction, here’s an overview.
What is an exchange?
An exchange is just the endpoint an application can publish to. It is not the message, the message name, or anything else. Multiple types of messages can be published to one exchange. Multiple applications can publish to the same exchange. It’s just the entry-point into RabbitMQ.
What is a routing key?
A routing key is just a string that is sent along the message as an attribute of the message. It can be more or less anything you like: the type of the message, the subject of the message, your name, a number,…
What is a queue?
A queue is an endpoint that one or more applications can subscribe to. If more than one application subscribes to a queue, only one application will get the next message. There is no guarantee which application will get the next message.
With that out of the way, let’s look into the configuration in a next post.