Message Source & Message Processors in Mule
Message Source : Message source accepts message from external source and triggers the flow to execute.Message sources are basically connectors like HTTP,FTP,Database,etc.
Message Source is a concept used in Mule ESB application from version 3.x backward, is the important part. In this tutorial, I will share with you all detail about this concept.
In a Mule ESB application, Message Source will be a component create new Mule Message from receiving or retrieving data from other systems. After creating a Mule Message, this message will be processed by one or more Message Processors.
Example, if we have an HTTP Listener Connector in Message Source, this connector will be a component to other systems can call to our Mule ESB application and pass the data.
And if Database Connector in Message Source, when we run our Mule ESB application, this connector will connect to the database and get the data base on the configuration to create Mule Message.
In Anypoint Studio IDE, if you look at Flow Editor, you will see the Message Source in the first part of a Flow.
In a Flow of Mule ESB application, we only have one Message Source.
Mule ESB supports many types of Message Source:
Inbound Endpoints
Polls
Custom Message Sources
These are the Connectors that we can call them, making our Mule ESB application in a passive position. It means that when using these connectors, our Mule ESB application must wait for the third party to call before creating the Mule Message.
Message Processor : It manipulates the message like transforming,filtering,enriching,etc.Processors are like transform message, filters,validators,etc.
After Mule receives a message from a Message Source, it uses one or more message processors to process the message through a flow.
These can transform, filter, enrich, and otherwise process the message as it transitions through your flow.
Message Processors can be categorized by function as follows:
Connectors send and receive data, and plug into external data sources via standard protocols or third-party APIs.
Components are flexible tools which perform business logic implemented in Java, Javascript, Groovy, Python, or Ruby.
Filters only allow certain messages to continue to be processed in a flow based on certain criteria.
Routers control message flow to route, resequence, or split and aggregate messages in a flow.
Scopes wrap snippets of code to define fine-grained behavior within a flow.
Transformers convert message payload type and data format to facilitate communication between systems.
Exception Strategies handle any errors that occur during message processing.
Business Events capture data related to key performance indicators.
for a mule flow to compile a flow must have a message processor(message source is optional).
In Above figure HTTP connector is message source because it listens the request from external source and rest of components are message processors.Here,
logger : logs request on console.
Transform message : transform format from one form to another(eg. xml to json)
Set Payload : Sets data or body.
No comments:
Post a Comment