RE2 PROGRAMMING

RabbitMQ - Efficient delivery of messages in complex routing scenarios

A software architect who deals with a lot of microservice-based systems must have surely come across or implemented RabbitMQ, which is a message queuing software and can be simply understood as a “Message Broker”.  The aim of this software is to facilitate asynchronous messaging between various services or simply define queues, to which applications connect in order to transfer a message or messages.

These messages can accommodate any kind of information ranging from a simple text message to information regarding a process to be executed on another application. RabbitMQ acts as a post office that collects and queues these messages until a recipient connects and takes a message off the queue. This scheme of asynchronous messaging makes message production by a producer decoupled from its processing by a consumer.
Message broking software usually typically facilitates two types of messaging patterns — message queuing and publish/subscribe. Message Queuing, multiple users can send messages to the same queue but the message is locked or removed from the queue when the assigned recipient processes this message. Whereas in the Publish/Subscribe(or pub/sub) communication pattern, a single message can be received and processed by multiple users concurrently. In RabbitMQ there are two types of subscriptions: An ephemeral subscription, where the subscription is only active as long the consumer is up and running, and A durable subscription in which the subscription is maintained as long as it’s not explicitly deleted.
RabbitMQ is used to reduce loads and delivery times of web application servers by decoupling tasks instead of being forced to perform resource-heavy procedures on the spot that may delay response time. When you want to distribute a message to multiple consumers or to balance loads between workers, Message queuing is the best tool. RabbitMQ with the help of exchanges routes these messages to specific queues with the help of bindings and routing keys.

RabbitMQ implements pub/sub using message exchanges, A publisher publishes its messages to a message exchange without knowing who the subscribers of these messages are. Each consumer can subscribe to exchange by creating a queue, the message exchange then queues produced messages for consumers to consume. Based on various routing rules It can also filter messages for some subscribers. These routing parameters are controlled using RabbitMQ’s API.

RabbitMQ features several built-in exchange types for the typical routing logic. For more complex routing you can bind exchanges together or even write your own exchange type as a plugin, With this RabbitMQ is supported on most modern languages and has a user-friendly management UI that allows you to monitor and control all dimensions of your message broker, This gives rise to its large client base and therefore a large community producing all sorts of clients, plugins, guides, etc.

– Aditya Singh