97008 48403
+91 40-27177600

Blog

Five Steps of Queuing in Mule ESB using RabbitMQ

single-blog

From the technical center of excellence of Massil Technologies, our technology leader Srini makes it easy to understand the complex situations you come across in Mule ESB from the experience of Massil Technologies to have countered them in their experience of working on client projects in real time. This blog addresses the five steps involved in queuing in Mule ESB using RabbitMQ. This blog is a part of series of blogs being authored and published by Massil Technologies for the benefit of the IT community globally.

What is RabbitMQ?

As per the definition published at https://www.rabbitmq.com/, RabbitMQ is the most widely deployed open source message broker. With more than 35,000 production deployments of RabbitMQ world-wide at start-ups and large enterprises, RabbitMQ is the most popular open source message broker. RabbitMQ is lightweight and easy to deploy on-premises and in the cloud. It supports multiple messaging protocols. RabbitMQ can be deployed in distributed and federated configurations to meet high-scale, high-availability requirements. RabbitMQ runs on many operating systems and cloud environments and provides a wide range of developer tools for most popular languages.

Installation of RabbitMQ:

To install Rabbit MQ you need to install Erlang in your system for download and install erlang go to https://www.erlang.org/downloads

Download the appropriate version for your system and install it.

Download the RabbitMQ into your system. To download RabbitMQ go to https://www.rabbitmq.com/download.html

Step1:

Install RabbitMQ. Its default Port is “15672” but by installing you won’t be able to access it.To enable the port you have to install certain plugins as explained in Step2.

Step2:

  • Open your command and find the path “C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.11\sbin”
  • This is the directory of RabbitMQ package in your system.
  • Run the batch file of RabbitMQ by running the below command “rabbitmq-plugins enable rabbitmq_management”.

Step3:

By running above command, it will enable plugins like ampq_clinet and cowlib so on.

Step4:

In your browser open the new window and go to ‘loalhost:15672’.It is default port for RabbitMQ.

Step5:

It will ask you to enter username and password. For the new user who doesn’t have any credentials to login into the server. Try these default credentials username: “guest”, Password: “guest”. Now you will get into the admin portal.

Go to queue tab and Create a queue.

Give a name for the queue and hit add queue button then the queue will be created.

Steps in AnyPoint Studio:

Step1:

Create a new project.

Step2:

Check whether you have AMQP connector in your palette or not.

Click the indicated option in the image, it will take you into exchange

Alternatively, you can find this in the >Help > install new software > Any point Connectors Update Site -https://repository.mulesoft.org/connectors/releases/3.5.0

Step3:

Drag an HTTP connector from palette and configure it

Step4:

Connect an AMQP connector to the HTTP and configure it like > General Settings >> Address attribute >>>give a proper queue name in the field of queue name.

Go to General Settings >> Property Attribute, the select checkbox called queue durable.

Go to Advance Settings >> Exchange Pattern >> Make as a one-way (Default)

^Reference settings

^ connection Reference

Create a new connection by clicking the ‘+’ symbol

Go to Reference Settings >> Connection Reference >>>Protocol, and check the details

Save the settings made.

Step-4:

Add a payload to at the end of flow to run the project.

Step-5:

Send a message using postman to the project.

So far, we have seen how a message can be published, we now will see how to subscribe for it.

Subscribing to a message:

Step1:

Take a new flow of the project. 

Step2:

Take an AMPQ connector and configure same as shown previously. Add acknowledge component to acknowledge the received message.

 

Step3:

To store the message, take a file connector and give a path to it.

Queuing in Mule ESB using RabbitMQ17-massiltechnologies
Queuing in Mule ESB using RabbitMQ17

Step4:

Run the project and send the message through postman. you can see the message will be stored in the given path.

Step5:

Test your project using postman.

In the project, the first flow will be to publish the message. Second flow will be to subscribe for it. File connector will save the message in the file path you gave.

In RabbitMQ:

You can see the graph which will show you how many messages are published how many clients received the message.

Hope this article from Massil Technologies was useful for you. If you have any further queries on this topic, please reach out to info@massil.tech.

Leave a Reply

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

Contact Us

Get in touch with us

Scroll to top