2. INDEX
What is a listener?
Mule HTTP Listener
Configure one in Mule
Result
3. What is a listener?
A listener is a class or method or interface or any implementation
which is responsible for handling a specific event. It can be any kind of
event like a remote procedure call, a method invocation or anything
like that.
4. Mule HTTP Listener
The HTTP Listener Connector provides the most practical way to listen for HTTP
requests.
The connector can be set up to accept any request, or to only accept requests that
are addressed to a very specific URI. You can choose what methods the connector
can accept (GET, POST, etc). The request body is passed on to the next element you
place in your flow as the message payload of a Mule Message, meanwhile headers,
query parameters, URI parameters and other elements of the HTTP Request are
passed on as inbound properties.
5. Configure one in Mule
Create a new project in Mule Anypoint Studio.
In the mule graphical editor drag and drop menu add HTTP listener to the
canvas. A new flow will be generated automatically. Following diagram depicts
the HTTP connector.
In my example I’ve setup a set payload mule transformer in the flow which will
return a particular message to the calling entity.
6. Result
When there will be a call to this flow from browser, the Mule HTTP Listener will
intercept it and return the message that is set in payload by set payload mule
transformer.
7. Result
When there will be a call to this flow from browser, the Mule HTTP Listener will
intercept it and return the message that is set in payload by set payload mule
transformer.