RabbitMQ – Tutorial Series


We will focus on playing with RabbitMQ, a very famous open source message broker you will  certainly encounter while developing applications.

Here are the topics covered in the series :

  • Launching RabbitMQ using a docker image
  • Populating data using a Java Spring Application.
  • Consuming data using another Java application
  • Adding a Go consumer
  • Monitoring the broker using TIG (Telegraf Influx Grafana)

First of all, if you need more information about this message broker and how to handle it, simply head to RabbitMQ – example with Java (you may pick up any of the examples provided in the Getting started section).

You may also browse the various resources on Github to get your hands on the broker and join in the community.

Note that the server is built using the ERLANG language.

RabbitMQ Server Community

Launching RabbitMQ using Docker

This time, rather than using a Bitnami version of the image, we will ship our docker-compose file with the based Alpine Linux one.

Note : the Alpine Linux version as mentioned in the guide only takes about 100MB of space while Bitnami version reaches about 250MB.

The management image based on Alpine approximately sizes 150MB.

version: '3'


    image: "rabbitmq:management-alpine"
    hostname: "rabbit"
      - "15672:15672"
      - "5672:5672"
      - ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf

As you can see, we also bundle the RabbitMQ management plugin which provides a management interface (accessible using 15672 port) and HTTP API.

Also we added the hostname parameter to let our container be reachable using this name.

The API lets us monitor and manage our RabbitMQ nodes and clusters.

The next file represents some custom configuration parameters you may add to your own instances. Don’t hesitate to check other parameters from the documentation depending on your needs.

default_user = user
default_pass = pass

No big deal here, we let the default configuration except for the credentials. However on production, you should take a closer look at the documentation.

Time to run the container :

$ docker-compose up -d

Without the “-d” parameter, you can directly access the logs and have the following kind of output :

RabbitMQ logs

RabbitMQ Management UI & HTTP API

Let’s first see our broker running !

Head toward the Web UI using the following URL : http://localhost:15672/

RabbitMQ login in

Simply input the credentials provided in the configuration file and admire the result.

RabbitMQ UI

Well, you’ve successfully set up an instance of RabbitMQ at the moment and it’s time to actually use it !

The next tutorial will cover the publication of messages onto the server using a Java application. But we won’t let you wait until then and check out what’s following.

Monitoring RabbitMQ

Briefly (in case you don’t know) a message broker accepts messages and deliver messages 🙂

Using the HTTP API provided by the management plugin we can simply make HTTP calls in order to manage the configuration of our broker.

Let’s first get a recap of what is in our instance :

$ curl -u user:pass http://localhost:15672/api/overview | jq

Few RabbitMQ statistics

And for a list of all provided endpoints of the API, take a look at this page.

Remember the above command to get a quick look at the statistics !

RabbitMQ messages management process

Well this part is a short dive into the background of the broker.

For those who need more details, follow the resources provided here as this is just an introduction on how RabbitMQ serves messages.

The most important thing is the fact that the broker is following the Advanced Message Queuing Protocol (AMQP) 0.9.1.

And using plugins RabbitMQ can handle other protocols including the AMQP 1.0 one.

Taken from Wikipedia : The AMQP is an open standard application layer protocol for message-oriented middleware. The defining features of AMQP are message orientation, queuing, routing (including point-to-point and publish-and-subscribe), reliability and security.

AMQP is a wire-level protocol. A wire-level protocol is a description of the format of the data that is sent across the network as a stream of bytes. Consequently, any tool that can create and interpret messages that conform to this data format can interoperate with any other compliant tool irrespective of implementation language.

What is to retain from this ?

As we must follow the protocol (more details about version 0.9.1 here) in order to communicate, using any programming language implies the use of a library or coding from scratch the whole process.

We chose Java and Go for the next articles covering RabbitMQ.

In the mean time, read on the AMQP model concept on the website by clicking on the image :



I hope you enjoyed the lines as much as I did and welcome any valuable comments.

Take care !

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Want more information?

Related links will be displayed within articles for you to pick up another good spot to get more details about software development, deployment & monitoring.

Stay tuned by following us on Youtube.

%d bloggers like this: