RabbitMq – Open Source Message Broker

| By Webner

RabbitMq Installation

Installation on Linux machine

  1. Update the package list
    sudo apt-get update -y
  2. Install prerequisite in most cases
    sudo apt-get install curl gnupg -y
  3. Install RabbitMq
    sudo apt-get install -y rabbitmq-server
  4. Start RabbitMq
    sudo systemctl start rabbitmq-server

RabbitMq Installation on the windows machine

  1. Install via chocolatey
    choco install rabbitmq
  2. Chocolatey(RabbitMq package) is open source and available on git


By default, RabbitMq listens to port 5672 RabbitMq server.

Related Terms

Everything/Messages go to queue for further processing.
Whatever message produced by the publisher goes to the queue and from the queue, the consumer consumes.
The publisher doesn’t contact the queue directly. It needs an Exchange.

It is an additional layer to implement the concept of abstraction. The producer doesn’t know further processing of the messages.

Also if we have multiple queues, the exchange is responsible for routing the messages to the specific queue.

In order for a user to work with RabbitMQ, it should 1st initialize a connection.
RabbitMq 3

Routing Key
The producer will specify a routing key along with the message to tell the exchange in which queue this message will go.
It is a connection between queue and exchange.
RabbitMq 4

Binding Key
Each binding has a unique binding key, to avoid any confusion for the target queue.

Let’s say we have two queues one with binding key white and the other with black.
If the producer specifies white – the message will go to the first queue and it specifies black message will go to the 2nd queue.

Note – Exchange will send message to the queue where
Routing key = Binding key

Types of Exchange

  • Fannout
    It ignores the routing key and sends messages to all known queues.
  • Topic
    It allows partial matching of the routing key.
  • Header
    In this message, a header is used instead of a routing key.
  • Default
    It is also known as a nameless exchange. It is the ideal exchange. Which checks if the routing key is equal to a binding key or not.

Leave a Reply

Your email address will not be published. Required fields are marked *