A client wants to send a message. So, it calls the publishing function in the model. For instance, like this:
_model.BasicPublish(””, ”MyQueue”, null, ObjectSerialize.Serialize(message));
But what happens then?
To understand this, let’s first take one step back. When you set up RabbitMQ in your code, you choose a messaging type, Direct, Topic, Fanout or Header. These all have a set of rules that describes how the message should be distributed.
To read more about the messaging types, read this:
DIFFERENT TYPES OF MESSAGING IN RABBITMQ
The component that executes these rules is the Exchange.
So, the sender function delivers the message to the Exchange, which applies the rules and, in its turn, delivers the message to the queue or queues.
If you for example set up the type Direct, the message is sent to that single queue. Or if you set up Topic, it checks the routing key and only sends the message to the queues that subscribe to that topic.
The queue then, is the part of RabbitMQ that handles the communication with the receiver. One queue per receiving client.