Spring RabbitMQ

Filed Under: JMS

Spring RabbitMQ is the message broker based on Spring AMQP protocol implementation.

Spring RabbitMQ

In my previous post, we have discussed about AMQP Protocol and Spring AMQP Module in detail theoretically. Before reading this post, Please read that post here: Spring AMQP.

In this post, we are going to discuss on two things mainly: “How to install RabbitMQ Server” and “How to setup Queue & Exchanges in RabbitMQ Server”.

In my coming post, we will discuss and develop one Spring AMQP RabbitMQ Messaging application with one simple and useful example.

Spring AMQP Modules

Spring AMQP Projects are located at the following website: https://projects.spring.io/spring-amqp/

Spring Framework has two modules to support Spring AMQP RabbitMQ development.

  • spring-amqp:
  • It is base abstraction for AMQP Protocol implementation.

  • spring-rabbit:
  • It is the RabbitMQ implementation.

spring rabbitmq

Install Spring RabbitMQ Server

Please use the followings steps to download and install RabbitMQ Server into local system.

  1. Download Erlang and RabbitMQ Server softwares
  2. We need to install both Erlang and Rabbit MQ server to start our Application Setup.

    1. Download Erlang from http://www.erlang.org/download.html
    2. Download Rabbit MQ from https://www.rabbitmq.com/install-windows.html

    rabbitmq software

  3. Install Erlang Software
  4. First install Erlang by double clicking “otp_win64_R16B03-1.exe” then follow default options by clicking “Next” then finally click on “Install” button.

  5. Install Rabbit MQ Server Software
  6. First install Rabbit MQ Server by double clicking “rabbitmq-server-3.2.3.exe” then follow default options by clicking “Next” then finally click on “Install” button.

    Once we install Rabbit MQ Server, we can see it’s HOME folder as shown below:

    rabbitmq server folder

    Set the following SYSTEM variable if missing.

    RABBITMQ_HOME=C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3

  7. Configure Rabbit MQ Server
  8. By default, Rabbit MQ Server comes with no plug-ins that means we cannot use it as a JMS Provider. We need to perform the following steps:

    Open CMD Prompt

    CMD>CD to ${RABBITMQ_HOME}/sbin

    Install Rabbit MQ Plug-ins by using below command

    CMD> rabbitmq-plugins.bat enable rabbitmq_management

    Restart Rabbit MQ Server from Windows Control Pannel –> Services

    rabbitmq windows services

    Access Rabbit MQ Admin console by using http://localhost:15672/

    Default login details: guest/guest

    rabbitmq server admin console

    Rabbit MQ Server home page

    rabbitmq server admin homepage

  9. To view existing Queues
  10. Click on “Queues” to view existing queues or create new queues

    rabbitmq queue

  11. To add New Queue
  12. Click on “Add a new queue” link to create a new queue and provide details

    rabbitmq queue create

    Click on “Add queue” button

    rabbitmq queue created

Spring AMQP RabbitMQ Server Setup

We need to do the following setup to develop Spring AMQP Messaging application with RabbitMQ Server.

  1. Install Erlang and RabbitMQ Server (Please refer previous section).
  2. Access Rabbit MQ Admin console
  3. Access Rabbit MQ Admin console by using http://localhost:15672/

    Default login details: guest/guest

  4. Configure Exchange and Queue in RabbitMQ Server
  5. Create queue = “tpQueue”

    spring rabitmq setup

    Click on “Add queue” button

    spring rabitmq install

    Create an Exchange and map it to previously created Queue

    spring rabitmq setup3

    Click on “Add exchange” button

    spring rabitmq add exchange

    Click on “tpExchange”

    spring rabitmq exchange

    Then map “tpExchange” with “tpQueue” with some routing key

    spring amqp rabitmq server setup

    Click on “Bind” button

    spring rabitmq bind

Now it’s time to start Developing Spring AMQP RabbitMQ Messaging Application!

That’s it all about Spring AMQP RabbitMQ Installation and setup process. We will discuss and develop Spring AMQP RabbitMQ Messaging Example in my coming posts.

Further Reading: Spring AMQP RabbitMQ Example, Apache ActiveMQ

Reference: Official Website

Comments

  1. RK says:

    Need basic example Spring AMQP RabbitMQ Messaging for as I am new to it .

  2. Hi Rambabu,

    Could you please explain how can we create the exchange, queue, and binding programmatically?

    Regards,
    Himansu

  3. raghu says:

    please check spelling ” rabbitmq-plugins.bat enable rabbitmq_management”

    1. Rambabu says:

      Hi

      Thanks for finding typo error, fixed it.

      Ram

  4. Ivan says:

    YOure a genius

  5. Rambabu says:

    I will fix one typo error in first diagram soon.

Leave a Reply

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

close
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages