Start MuleSoft (Installation + Hello World)

This tutorial will guide you through installing the right software to running your first MuleSoft application. Although my pictures show Mule 4 Runtime (the thing that runs the application), this tutorial is good for any version of Mule Runtime.

Download the Stuff

  1. Download Anypoint Studio IDE (this is where you will code): Although the website says something about a “trial for 30 days”, they mean Anypoint Platform (website where you can make and deploy API’s). But for just the IDE Anypoint Studio, downloading this 100% free forever.
  2. Download Postman (this is where you will get to interface with your code): Although Postman is also a website, the app is way better in my opinion.
  3. Download JDK 8 (Java Development Kit): development environment for building applications using Java.

Create Hello World Project

  1. Open your Anypoint Studio IDE and create a new Mule project by clicking at the top File -> New -> Mule Project
  2. Name your project firstproject (lowercase is the conventional syntax) and click Finish.
  3. Go to src/main/mule and open firstproject.xml

Drag Connectors

  1. See the Mule Palette on the right? Drag an HTTP listener onto the canvas. You will see a flow automatically get created named firstprojectFlow. Flows are analogous to functions in OOP.
  2. In the palette to the right, search for “Set Payload” and drag it to the right of the HTTP listener in the flow.

Configure The Connectors

  1. Double click on Set Payload, erase the Value written in, and make the Value this: Hello World!
  2. Now, click on the HTTP listener (we will create a configuration so it can accept HTTP requests from Postman later).
  3. At the bottom, click on the green plus sign next to Connector configuration, put the host as 0.0.0.0 and port as 8080, and click OK!
  4. Now, we need a path we want to channel our HTTP requests through. In the path field of the HTTP listener, type /path (the HTTP listener path will always tell you where the requests will go to)
  5. Save your application, right click on the canvas on a white space next to your flow, and run your project

Send Request and View Response 

  1. Open Postman
  2. Leave everything as is but put this as the path: localhost:8080/path
  3. Click Send and you should see Hello World be the response!

You just created your first Hello World application! Basically, you create an HTTP Listener to listen for HTTP requests that we send through Postman. Since we did a GET request to the HTTP Listener, it “got” us the payload that was returned from the flow.

For extra help, check out the free course MuleSoft offers on https://training.mulesoft.com/course/mulesoftu-fundamentals

Leave a Reply

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