Sending JMS messages with the JMS outbound endpoint in Mule

This tutorial will show you how to use Mule JMS Transport in Mule based application. Let’s take an example, set up a flow to accept notifications from Accounting application when an expense report’s processing has been completed. A  more realistic use case is to take the notifications and dispatch them to a JMS topic to which interested parties can  subscribe and be notified as expense reports are finalized.

You can be interested in Mule JMS Transport with Active MQ


Mule Studio 3.x(Anypoint Studio) (Download from
Maven 3.2.1 (Download from
JDK 1.7 (Download from

Configure JDK, Maven and Mule Studio

Step 1. First install JDK
Step 2. Add the Java_Home/bin directory to your system’s PATH.
Step 3. After downloading Maven, extract it to a drive
Step 4. Add the M2_Home/bin directory to your system’s PATH.
Step 5. Download and extract Mule Studio to a drive
Step 6. Now start Mule Studio by clicking on AnypointStudio exe icon in the folder <physical drive>/AnypointStudio
Step 7. Once started, close the startup page
Step 8. In Mule Studio, go to Window -> Preferences. Expand Java, then click on Installed JREs. Add JDK 1.7 and select it. In expanded Java, click on Compiler and select the compiler level as 1.7
Step 9. Now expand Anypoint Studio and click on Maven Settings. Then select appropriate Maven installation home directory using Browse button.
Step 10. If you want you can input Default groupId for new projects, it will save your time every time when you want to create a new project.

Create Mule project in Mule Studio

Now we will see how to create a new project in Mule Studio(Anypoint Studio).

Step 1. In Anypoint Studio, go to File -> New -> Mule Project
Step 2. Input Project Name: mule, Runtime is by default selected, tick on Use Maven; here the artifactId is automatically picked up from the Project Name:, the Group Id is picked up from the Default groupId for new projects and version is also a default value.
Step 3. Click Next and verify the JDK, mainly select Use default JRE(currently ‘jdk1.7.0_x’)
Step 4. Click on Next and click on Finish.


Step 1. Create the jms-msg-with-jms-outbound.xml file under src/main/app directory and put the below file connector. While you create the xml file you will see on red mark on each file connector. Do not worry, red mark will be disappeared once you modify the xml file as given in Step 3.

jms msg with jms outbound

Step 2. Open the jms-msg-with-jms-outbound.xml file and click on Configuration XML view in the Editor.
Step 3. Modify the jms-msg-with-jms-outbound.xml file as shown below

In the above configuration we a Mule flow named as jms-msg-with-jms-outbound-flow and inside this flow there is one http connector, which is acting as inboud-endpoint and handles request and there is another connector called jms , which is used to send message to Active MQ topic.

Step 4. Add Active MQ dependency to the pom.xml file

Running the Active MQ

Extract the downloaded zip activemq in physical drive. Then open a command prompt and navigate to the <physical drive>apache-activemq-5.11.1bin and execute the command activemq start

Then open browser and hit the URL http://localhost:8161/admin and when prompted for username/password, type admin/admin and click on Topics.

Running the application

Now do a right-click on the jms-msg-with-jms-outbound.xml file or on the mule project and click on Run As -> Mule Application. Then you will see something like below in Console when the application runs

Now hit the URL http://localhost:8081/status/Successful in the browser, you will see below output in the Mule console.

Console output

Now you will see below output under the Topics in admin console of Active MQ.

jms msg with jms outbound

Thanks for reading.


Software Professional, I am passionate to work on web/enterprise application. For more information please go to about me. You can follow on Twitter. You can be a friend on Facebook or Google Plus or Linkedin

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.