What is RabbitMQ ? How to Install?

RabbitMQ is an open source Message broker software that facilitates asynchronous communications between components of distributed systems.

It implements Advanced message Queuing protocol AMQP.

Basically exchange and queue routes message from producer to consumer.

Exchange -> Routes the message to appropriate Queue

Queue -> Routes to appropriate Application(consumer)

Why do we need RabbitMQ ?

Lets assume we have an e-commerce website which sells shoes.

Now, Once the costumer places an Order we have to do multiple task such as payments, order confirmation message/mail sending, sending delivery notifications.

all these task doesn't have to be done one by one, we can do it asynchronously like sending message and payment and sending notifications can be done randomly and parallelly to make things faster.

But how to do it asynchronously ? well we can write a very complex thread related code which can do this. But is it worth it? we all know how complicated it can be while managing threads or thread pool from my thread related blogs .

That's why we need messaging Queue like RabbitMQ who can handle this for us and we can be saved from all those complicated codes.

How to install RabbitMQ in windows 10 ?

  1. Go to https://www.rabbitmq.com/install-windows.html and download the rabbitmq-server-3.12.12.exe.

  2. Go to https://www.erlang.org/patches/otp-25.3.2 and download Erlang for windows.

  3. Then first install Erlang and set environment variables as below.

  1. Then install RabbitMQ using the exe file.

  2. Once installed go to "C:\Program Files\RabbitMQ Server\rabbitmq_server-3.12.12\sbin" and run the command "rabbitmq-plugins.bat enable rabbitmq_management" using command prompt. It will enable some plugins.

  3. Once done you can start and stop the RabbitMQ using below shortcuts

  4. Then you can access RabbitMQ UI with the URL "http://127.0.0.1:15672/" or "http://localhost:15672/"

    initial Credential is "guest/guest"

Now that you have installed RabbitMQ, in the next blog we will continue to learn more about RabbitMQ.

Did you find this article valuable?

Support Java Blogs By Hemant by becoming a sponsor. Any amount is appreciated!