Mule ESB Hello World Example
Mule ESB Hello World Example
More..
0
Mule ESB is a Java-based Enterprise Service Bus (ESB) that allows to implement communication between
applications in a service oriented architecture (SOA).
0
In this example, we will create a simple Mule application to implement the following ow :
The ow accepts HTTP requests, sets a payload on the message, applies some transformation on the
payload, and nally returns a response to the end user.
So we will use :
HTTP endpoint : it allows, in the beginning of the ow, to receive request from the end user, and, in the
end of the ow, to return the message as response to the end user.
Java Transformer : to apply a custom transformation on the payload : "Hello " + {payload}
Echo component : to display the message payload.
1. Technologies used
Anypoint Studio
JDK 1.7
3. Java Transformer
To apply a custom transformation on the message payload, we have used Java Transformer.
1 package com.keylesson.transformer;
2
3 import org.mule.api.transformer.TransformerException;
4 import org.mule.transformer.AbstractTransformer;
5
6 public class KeyTransformer extends AbstractTransformer {
7 @Override
8 protected Object doTransform(Object src, String enc)
9 throws TransformerException {
10 return "Hello " + src.toString().substring(1);
11 }
12 }
5. The video tutorial
It demonstrates how to build and test the Mule application used in this tutorial :