Over a million developers have joined DZone.

Integrating Mule and RabbitMQ

DZone's Guide to

Integrating Mule and RabbitMQ

RabbitMQ can be deployed in distributed environments to meet high-scale, high-availability requirements.

· Integration Zone ·
Free Resource

WSO2 is the only open source vendor to be named a leader in The Forrester Wave™: API Management Solutions, Q4 2018 Report. Download the report now or try out our product for free.

RabbitMQis one of the open source message brokers or queue manager software, which uses Advanced Message Queuing Protocol (AMQP). It implements a broker architecture, meaning that messages are queued on a central node called Exchange before being sent to clients. This approach makes RabbitMQ very easy to use and deploy. RabbitMQ can be deployed in distributed environments to meet high-scale, high-availability requirements.

The Message Flow in RabbitMQ

Image title


Integrating RabbitMQ with Mule and publishing an Employee Details onto a queue using RabbitMQ.


  • Mule Anypoint Studio.
  • RabbitMQ server and server details.

To Integrate RabbitMQ with Mule, you need to have AMQP connector installed in Anypoint studio. So, first, download and install AMQP connector from the Anypoint exchange. Once the connector is installed, you can find all the endpoints and transformers related to AMQP in Mule Palette section.

Image title

Creating Mule Project to Publish Messages to RabbitMQ:

Once the project is created, configure HTTP endpoint in the source part of the flow. Once this is done, drag and drop AMQP connector onto the process part of the flow. 

Image title

Image title

Unlike other connectors, AMQP connector does not have connector configuration available in the connector to configure the connection details. So, we have to create a connection in global elements, and from there, the connector picks the connection details.

Configuring the AMQP Connector:

  • Go to global elements and select create the new global element.Image title

  • Search for AMQP and select AMQP Connector.Image title

  • Now go to protocol part and provide all the RabbitMQ server details like RabbitMQ host, port, Username, password, and other details. Once the configuration is done, proceed by selecting ok.Image title

  • Now go back to the flow canvas, select AMQP, and provide the queue name to which employee details need to be published.

Note: Unlike ActiveMQ it will not create a queue if it is not present. 
One should provide the name of the queue which is already present in the server queues. 

I have already created a queue (Employee) in the server, so I am just providing the name here.Image title

Once this done, deploy the application in the Anypoint studio. Once the application is deployed successfully, invoke the rest service. In my case, I am posting the employee details to the rest service.Image title

After invoking the service, go to RabbitMQ console and select the queue to which you have published the message. Image title

Here, you can find a list of the actions that can be performed on the queue. Expand Get messages.Image title

After expanding the Get messages action, configure the number of messages that need to be retrieved and other details, and then select Get Message(s).Image title

Now you can see the message that had been published and other JMS properties. Image title


You have seen how to configure the AMQP connector, publish the messaging to the RabbitMQ, and use the RabbitMQ console to see the messages in the queue.

Read the WSO2 Methodology for Agility to see how you can transform your integration projects from semi-agile to a scalable continuous agile approach.

integartion ,mule ,anypoint studio ,rabbitmq ,amqp ,queue

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}