DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • MDC Logging With MuleSoft Runtime 4.4
  • MuleSoft APIkit Router - QueryParam and Header Strict Validation Configuration
  • How to Use Mulesoft VM Connector
  • Integrate Cucumber in Playwright With Java

Trending

  • Claude Code Superpowers: The 5-Tool Stack That Ends Limits and Context Amnesia
  • How You Clear Your HTML5 Canvas Matters
  • The Window Closes: Why I Switched to Kotlin Before the Codebase Got Too Big
  • The Self-Hosting Math Changed While We Were Still Arguing About Sovereignty

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. MuleSoft Integration With RabbitMQ

MuleSoft Integration With RabbitMQ

MuleSoft integration with RabbitMQ to consume messages from a queue.

By 
Muhammad Noman
·
May. 26, 21 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
19.4K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

This article will explain in detail, how to integrate with RabbitMQ in MuleSoft and read messages from a queue.

Install and Setup RabbitMQ on Mac

In this section, I will explain how to install RabbitMQ on Mac, create a new queue and publish messages to the queue using the RabbitMQ portal.

Step 1: Install RabbitMQ.

brew install rabbitmq

Step 2: Start RabbitMQ Server.

Start RabbitMQ server in the foreground using the below command:

rabbitmq-server

Or start the server in the background using the below command:

brew services start rabbitmq

Step 3: Access RabbitMQ.

http://localhost:15672/

Access RabbitMQ

Enter both username and password as guest.

Step 4: Create New Queue.

http://localhost:15672/#/queues

Step 5: Publish Message in Queue.

http://localhost:15672/#/queues/%2F/order

Publish Message in Queue

Setup Mule Application 

In this section, I will explain how to create a new Mule application, listen on RabbitMQ queue, read a message from the queue.

Step 1: Create a new Mule 4 application:

Open Anypoint Studio click on File -> New -> Application Name (app-rabbitmq-orders).

Step 2: Install AMQP connector from the exchange:Install AMQP Connector From Exchange

Step 3: Create flow to read the message from order queue:Create Flow to Read Message

XML
 




xxxxxxxxxx
1
14


 
1
<?xml version="1.0" encoding="UTF-8"?>
2

          
3
<mule xmlns:amqp="http://www.mulesoft.org/schema/mule/amqp" xmlns="http://www.mulesoft.org/schema/mule/core"
4
    xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
5
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
6
http://www.mulesoft.org/schema/mule/amqp http://www.mulesoft.org/schema/mule/amqp/current/mule-amqp.xsd">
7
    <amqp:config name="AMQP_Config" doc:name="AMQP Config" doc:id="de2abf40-5ad2-4942-a874-99d12c486b4b" >
8
        <amqp:connection host="localhost" username="guest" password="guest" />
9
    </amqp:config>
10
    <flow name="app-rabbitmq-ordersFlow1" doc:id="aa37df28-a708-4d2d-8ee1-ee8ca0c4dfd0" >
11
        <amqp:listener doc:name="OrderQueueListener" doc:id="88ebbb66-8592-44f2-aee0-2d39ddb66d63" config-ref="AMQP_Config" queueName="order" ackMode="IMMEDIATE"/>
12
        <logger level="INFO" doc:name="RqbbitMQ Message" doc:id="4b2c8676-8baf-4ba2-adee-e28f0f1edc06" message="#[payload]"/>
13
    </flow>
14
</mule>


Step 4: Test the MuleSoft Application ListenerTest MuleSoft Application Listener


MuleSoft Integration application Command (computing) Connector (mathematics) Testing XML Flow (web browser)

Opinions expressed by DZone contributors are their own.

Related

  • MDC Logging With MuleSoft Runtime 4.4
  • MuleSoft APIkit Router - QueryParam and Header Strict Validation Configuration
  • How to Use Mulesoft VM Connector
  • Integrate Cucumber in Playwright With Java

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook