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

  • Idempotency Under Concurrency: Why Your Application Check Isn't the Last Line of Defense
  • Running a Self-Hosted WAF in Production: Practical Lessons From SafeLine
  • Your Application Has an Unindexed Attack Surface. Do You Know What’s in It?
  • Retrieval Augmented Generation With Spring AI 2.0, Claude, and PGvector

Trending

  • Agentic Test Creation: From Plain-Language Requirements to End-to-End Test Cases
  • MySQL Instant DDL: Metadata Locks, Waiting Writers, and Query Pileups
  • Applying Microservices Lessons to Multi-Agent AI Systems
  • Google Cloud KMS vs. AWS KMS: Java Encryption Guide

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. Creating a Mule ESB Sample Hello World Application

Creating a Mule ESB Sample Hello World Application

Mule is a lightweight, open source integration framework. In this tutorial, learn the requirements and steps for creating a sample Mule application.

By 
Naseer Shaik
·
Updated Jan. 14, 21 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
91.2K 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

Mule ESB is an integration technology that can connect different applications. Mule is an open-source integration framework consisting of different Connectors that can easily integrate our applications.

Mule is a lightweight integration framework. Mule ESB includes powerful capabilities including REST, SOAP, JMS, Salesforce, Cloudhub, RAML, Http, Datasource, Dataweave, Java, and MongoDB.

MuleSoft Anypoint Studio is a user-friendly IDE where we can easily drag Connectors from the Mule Palette.

In this article, I am going to show you how to create a Mule ESB Sample Application. For this, we need the below requirements.

1. Java 8 (JDK 1.8)

2. Anypoint Studio

3. Postman

Mule ESB Sample Application

XML
 




x
15


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

          
3
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
4
xmlns:spring="http://www.springframework.org/schema/beans" 
5
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
7
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
8
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
9

          
10
  <http:listener-config name="HTTP_Listener_Configuration1" host="0.0.0.0" port="8081" basePath="/sample" doc:name="HTTP Listener Configuration"/>
11
    <flow name="sample-appFlow">
12
        <http:listener config-ref="HTTP_Listener_Configuration1" path="/{parmname}" allowedMethods="GET" doc:name="HTTP"/>
13
        <set-payload value="#[message.inboundProperties.'http.uri.params'.parmname]" doc:name="Set Payload"/>
14
    </flow>
15
</mule>



Follow the below steps or copy the above code into Mule Configuration XML (src/main/app/sample-app.xml).

Step 1: Open Anypoint Studio and Create a new project using File->New ->Mule Project.

To create New Project

Step 2: Type a Project Name like "sample-app" and press the Finish button.

Project Name

Step 3: Drag an HTTP Connector from Mule Palette.

Drag Http Connector from mule palette

Step 4: Click on the HTTP Connector and you can find HTTP Attributes in the below screen. We need to configure some details of the HTTP Connector.

Set Http Configure details

Step 5: Configure port "8081" and the Base path as "/sample" & press the OK button.

Http Configure Details

Step 6: Set the path as "/{paramname}" and Allowed Methods to "GET."

Http Configure Details

Step 7: Drag a Set Payload from Mule Palette.

SetPayload Connector

Step 8: Click on Set Payload and set the value.  #[message.inboundProperties.'http.uri.params'.parmname] 

SetPayload

Step 9: To run this application, right click on Mule Flow and select "Run Project sample-app."

How to run project

Step 10: You can see some logs in the console screen; the status is showing that the application was deployed.

Status Deployed

Step 11: Go to Postman:

                Select Method: "GET"

                URL: http://localhost:8081/sample/

                Param value: Helloworld

                Example: http://localhost:8081/sample/Helloworld

PostmanStep 12: To stop the application, go to Mule Flow, right click and select "Stop Project sample-app."

How to stop application

Enterprise service bus application

Opinions expressed by DZone contributors are their own.

Related

  • Idempotency Under Concurrency: Why Your Application Check Isn't the Last Line of Defense
  • Running a Self-Hosted WAF in Production: Practical Lessons From SafeLine
  • Your Application Has an Unindexed Attack Surface. Do You Know What’s in It?
  • Retrieval Augmented Generation With Spring AI 2.0, Claude, and PGvector

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