Mule School: Hello World

This is a series of blogs aimed at developers new to Mule that are just .  These lessons will introduce common concepts and implement frequent use case that we see in our community. If you have suggestions for a lesson, please post it in the comments.

The lessons are all based on Mule Studio, the free Eclipse IDE for Mule, you can get the latest version here.

Download Mule with Mule Studio

Once downloaded, unzip/extract the archive. Launch Mule IDE using <MULE_STUDIO_HOME>/mulestudio.

 

You’ll see this empty environment, we need to create a project.

Once in Mule Studio, create a new Mule project using File -> New -> Mule Project. Enter “LearningMule” as project name, “hello” for message flow name, leave default values in “create a java project” screen and click on Finish. You can now see necessary project source and configuration generated.

You’ll be asked to create a new Flow when you create a Mule project.

This is the canvas view,this is where we create Mule Flows. It is currently empty.

If not already selected, double click on “hello.mflow” to open hello mule flow in design mode.
Select HTTP end point from the component palette on the right side and drop it on to the message flow. Double click on HTTP end point and enter “hello” in path field.

This is the HTTP endpoint configuration dialog, every canvas item will have one of these dialogs.

The HTTP inbound endpoint generated, internally uses embedded Jetty server to read from HTTP request and pass the details on the Hello Mule flow. Click on “Configuration XML” tab to see the generated source.

<mule...>
  <flow name="helloFlow1" doc:name="helloFlow1">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="hello" doc:name="HTTP"/>
  </flow>
</mule>

Drag and drop “Echo” component, next to “HTTP” end point, from component palette to display information received from HTTP request. Right click on hello.mflow and select Run As -> Mule Application. Once you see success message in the console – “started app ‘learningmule’”, invoke hello.mflow using http://localhost:8081/hello. Response “/hello” can be seen in the browser.

Congratulations! You just completed your first lesson. You must now be familiar with installing Mule Studio, creating Mule projects, building and running Mule flows.


We'd love to hear your opinion on this post


5 Responses to “Mule School: Hello World”

  1. Thanks for this. I put off checking Studio out until this tutorial.

    One strange thing though: why not offer this as a plugin instead of a quarter gig download. Or maybe I didn’t look hard enough (I could not find a stand-alone Eclipse plugin on the mulesoft download page)?

    • Hi Tshepang, glad that this article prompted you to check out Mule Studio. Though we have an Eclipse plugin (Mule IDE), it is no longer actively maintained. Instead, users are strongly recommended to use Mule Studio. In addition to providing comprehensive tools necessary for ESB development, Mule Studio also offers unified environment for cloud applications. More on Mule Studio can be read from here.

  2. […] complete Hello World lesson from last week before proceeding […]

  3. Hi, there’s a mistake in the URL, it’s http://localhost:8001/hello and has to be http://localhost:8081/hello.
    Good start!