Mule ESB HelloWorld | Message Flow


Here in this tutorial, we will explore a simple transfer of message using a file and HTTP connectors.

Hello World demonstration is available on the youtube,


Let's create a Mule Project in AnypointStudio,
In MessageFlow Canvas, drag and drop the File Connect from the Mule Palette and configure File Connector as shown below,
Then use a logger activity within the flow next to Soure_File Connector as below,
We will again bring in a File connector for the destination configuration and a logger activity after that.
Here is our 1st Hello World File Transfer mule sample ready to be executed, to execute the project right click on the message flow and choose run project <projectname>. 

Once the project is Deployed, drop files in the source folder and see the outputs in the destination folder, monitor the logs in the console.


The message flow, whatever built-in Message Flow generates XML in the background and the same is available in Configuration XML tab.


Now let's build another flow to receive messages through HTTP post. Drag and drop HTTP connector from mule palette and configure it as shown below, add an HTTP listener with default settings.

Bring in a logger and log the message available in http post body,


then place a file connector to write the HTTP body message as a file in destination.


Finally, to respond back to the client with our response we will use Set Payload activity and configure our response as below.


Lets now deploy the project and test it, by right clicking on the message flow and choose run project <projectname>. 
Once the project is successfully deployed, we would use postman chrome extension to post a message as shown below. For the HTTP post, a file was created in the destination folder and 200 Response was received in postman.
Below are the logs in the console window for our HTTP post from the postman. 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.