Mini Project RabbitMQ and Java – part 1

Marcin Łącki

RabbitMQ is a message-queueing software also known as a message broker or queue manager. In simple words, it is software where queues are defined, to which applications connect in order to transfer a message or messages. Message-queueing software offers persistence, delivery acknowledgements, publisher confirms and high availability. RabbitMQ client handling many languages. Most popular as Java and .Net or less as Ruby.

RabbitMQ installation

Go to click Download + Installation button, and select installer for your system. Important RabbitMQ requires a 64-bit supported version of Erlang Erlang must be installed first, and must be run as administrator Before the next steps you should get familiar with rabbitmqctl. It is a command line tool for managing a RabbitMQ server. After installation (first Erlang, second RabbitMQ) go to cmd and try stop service:

cd C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.2\sbin


>rabbitmq-service stop

In console you should get information RabbitMQ stopped. OK let`s try check node status:

>rabbitmq-service start

When RabbitMQ is working:

>rabbitmqctl status

You will get information about OS PID, OS name, RabittMQ version, Erlang configuration and more.

Management Plugin

The RabbitMQ management plugin is helpful in management and monitoring of RabbitMQ nodes and clusters. Management plugin presents statistics, charts and warnings but for long term metric storage and visualisation there will be better use external tools as Grafana.

rabbitmq-plugins.bat enable rabbitmq_management

If plugin is started you can go to http://localhost:15672/. And login as guest, password: guest.

Maven installation

On your computer in your favourite localization create a folder e.g. Projects. Next download Maven and set enviroment variables M2_HOME and MAVEN_HOME as a directory with maven e.g:

C:\Program Files\apache-maven-3.6.3

And add in PATH%M2_HOME%\bin

How to check Maven

Run cmd as administrator and run:

mvn -version

Your response will be similar:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Program Files\apache-maven-3.6.3\bin\..
Java version: 1.8.0_101, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_101\jre
Default locale: pl_PL, platform encoding: Cp1250
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Go to your Project localization and run: For DgroupId and DartifactId please set own names

mvn archetype:generate -DgroupId=com.marcin -DartifactId=rabbit -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false

If you got:


We can go forward

Import project in IntelliJ

Select Import Project and select path e.g: If you got:


Click OK. In second window select checkbox Import Maven projects automatically go Next and Finish.


Set version for maven compiler which is a right for your installation:


Add dependency to RabbitMQ Java Client from Maven repository

<!-- -->

Go to App and run Hello World! If program is finished with the success we have ready skeleton. In the second part, we will connect RabbitMQ with the skeleton of the project and we will send and receive a message from the queue.

Poznaj mageek of j‑labs i daj się zadziwić, jak może wyglądać praca z j‑People!

Skontaktuj się z nami