What is RabbitMQ?
It is a message-queueing software called message broker or queue manager (an intermediary for messaging). It gives your applications a common platform to send and receive messages. Messaging is asynchronous, decoupling applications by separating sending and receiving data.
Messages are routed through exchanges (message routing agents) before arriving at queues. Hence it gives more control and flexibility over message routing. The exchange takes different message attributes into account, such as routing key, header attributes,. depending on the exchange type.
Binding: link that is set between a queue and an exchange.
Routing Key: message attribute based on which routing will happen.
Types of Exchanges
- Direct (message goes to the queue where binding key exactly matching with routing key)
- Topic (messages are routed based on the pattern match between routing and binding key)
- Fanout (messages are broadcasted to all the queues bounded with an exchange. Routing key is ignored)
- Headers (similar to topic, it matches message attributes [key-value] pair. It supports x-match=all/any whereas ‘all’ matches entire message attributes, ‘any’ looks for at least one match)
Steps to follow when setting up a connection and publishing a message/consuming a message
I hope, this article gives you an overview of RabbitMQ.
“TELL ME AND I FORGET. TEACH ME AND I REMEMBER. INVOLVE ME AND I LEARN.” –BENJAMIN FRANKLIN