RabbitMQ?

Sitharanishadini
3 min readJul 22, 2020

--

What is RabbitMQ?

RabbitMQ is a message queuing software or in other words a queue mennager which is an open source product. This is the most widely used message broker. This can be easily deployed on premises and also in the cloud.

Let’s find out why we need a software like RabbitMQ.

We use RabbitMQ as a message broker. A message broker acts as a middleman for various service like web applications etc. What actually softwares like RabbitMQ do is, it helps applications to respond to requests quickly instead of being forced to perform resource-heavy procedures on the spot that may delay response time. This also makes it easy to deliver the same message to many users. Simply this plays the roles of a postbox, post office and a postman. They store the mails and deliver it.

RabbitMQ supports multiple protocols.

- AMQP
- HTTP
- STOMP
- MQTT

Let’s take a simple example to understand the basics.

Think of two services.

Service 01: Online registration of customers. Take the details using a form.

Service 02: Send details of the registered customer to a database.

So what RabbitMQ does is , when the service 01 gives multiple customer information, it takes the information to a queue and send it to service 02 one by one. When server 01 take details of a customer and send it to the RabbitMQ queue, server 01 does not want to wait until server 02 to send details of customer 1 to the DB to take customer 2 details. This helps server 01 to do tasks quickly.

I guess now you have a basic idea about what RabbitMQ does. So let’s move to some profound details.

From here onward I use the word Producer for the application that sends the messages and Consumer for the application that receives the messages.

When producer sends a message to the RabbitMQ to be sent to the consumer, producer does not sent it directly to the queue. First the message is being sent to the Exchange. Then it binds the message and sent it to the queue. An Exchange is responsible for routing the messages to different queues with the help of bindings and routing keys. A binding is a link between a queue and an exchange. The routing key is a message attribute the exchange looks at when deciding how to route the message to queues (depending on exchange type). Then the messages stay in the queue until they are handled by a consumer.

There are 4 exchange types in RabbitMQ.

  • Direct: The message is routed to the queues whose binding key exactly matches the routing key of the message.
  • Topic: The topic exchange does a wildcard match between the routing key and the routing pattern specified in the binding.
  • Fanout: A fanout exchange routes messages to all of the queues bound to it.
  • Headers: Headers exchanges use the message header attributes for routing.

Features of RabbitMQ.

  • Reliability
  • Clustering
  • Flexible routing
  • Federation
  • Support multi protocols
  • Highly available queues
  • Management UI
  • Tracing etc.

Thank You!.

--

--

Sitharanishadini

Explore the world. You will always find new things to learn.