#[message] vs #[payload] in mule ESB - mule

I could see two different objects - message and payload in Mule Esb. But I am not able to understand the actual characteristics of the both. Could anyone kindly help me to understand this?.

The Mule message, #[message] is the data that passes through an application via one or more flows. It consists of two main parts:
The message header, which contains metadata about the message.
The message payload, which contains your business-specific data.
And The message payload #[payload] is the most important part of the Mule message which contains the data your Mule application processes.
Please refer Mule Documentaion for more details.

Related

Audit mule inbound outbound messages

we are trying to audit all incoming/outgoing messages, header information in our mule flow.
For same we have tried to use 'wire-tap' which we dint found so useful also its working on mule 3.6.1 but giving error in 3.7.
Any idea/suggestion for auditing?
Ok let me add some more details:
What we are trying to do is- Whatever message comes or flows via flow components we want to copy it in some sub flow (say in queue) without interrupting the main flow so that we can check the message.
you can make it work in several ways
1) Wire tap is one of the choice. You can route your messages asynchronously to sub flow and sub flow will do the auditing work. But I don't know why you didn't found wiretap useful. Can you explain in more.
2) All the messages your receive from the main flow, those you can post to JMS queue. So another flow will read from there and do the auditing work. Use of this multiple projects can use the same piece of code and post JMS queue for auditing.
This can be done in many different ways and you kind of mentioned them in your question such as logger component and interceptor.
All the headers are available as message properties so if you log the entire message they are shown. Simply put an logger component after the inbound endpoint and one before the outbound endpoint and this is easily done.
If you need some log entries transformation you could always put that in a wire tap so you don't interfere with the functionality of your flow.

Composite Source with WMQ Node in Mule ESB

By using composite source in Mule ESB, it is possible to get input from different queue at a time. Is there any method to get to know the input WMQ node name.e.g.
I have 2 queue (ABC & XYZ) from which input can be obtained and further transformation can be applied. Is there any possible way to get to know the queue name from which the message received.
There is no need to use composite-source if you need to behave differently based of the queue name.
What I would recomend is to design your flows acordingly to your needs:
flow(queueA)->flowVars.queueName="queueA"->flow-ref(realwork)
flow(queueB)->flowVars.queueName="queueB"->flow-ref(realwork)
flow(realwork)->dotherealworkhere

Mule:Setting Rest Call response as property in original message payload

Having a scenario where consuming a message from amqp:inboundendpoint and then requesting a call to rest service using HTTP outbound endpoint with request response message exchange pattern. I need to set properties of message payload received from amqp with certain data retrieved in HTTP outbound response. What is the best component to acheive this design. Do i need to call HTTP outbound inside an enricher and then enrich the payload with additional properties retrieved from rest call or is there any other design possible.
The message enritcher was designed exactly for this scenario please take a look a this.
Yes as Victor said, Mule Message Enricher will be a good option to be used in this kind of scenario..
What message enricher actually does is it enrich an incoming message with additional information (That's what your need ) and perform a particular task without disturbing or modifying the original payload...
So in that case, the message processor after enricher will be getting the original payload without being modified... So I can say, your approach is correct and you can go with enricher..
you can find more about enricher :- http://www.mulesoft.org/documentation/display/current/Message+Enricher
and
http://blogs.mulesoft.org/enrich-your-experience-orchestration-and-data-enrichment-with-mule-3-1/

what exactly a inbound end point and outbound end point in mule?

I have been trying to figure out, what exactly a inbound end point and outbound end point. For me it is bit of an eluding to understand.
what are exactly inbound and outbound endpoints for/do in mule flow? if a flow wants send message which endpoint shoud be used viz when receiving. Or when an application want to invoke a flow which end point it should communicate to?
Inbound endpoints are message sources (http://www.mulesoft.org/documentation/display/current/Message+Sources), which as the name suggests is where messages are created. They can be created based on external events (like an incoming HTTP request or JMS message) or by polling (like files in a directory).
Outbound endpoints and anything else you see in a flow (except exception strategies) are message processors (http://www.mulesoft.org/documentation/display/current/Message+Processors), which means they do something with the message in-flight the flow. Outbound endpoints are message processors that send the current message to "destinations" like a JMS queue, an HTTP server, a file, ...
Disclaimer: This is a simplified view to give you a general idea, its not the beginning or end of what you can do with mule (or other service buses)
Mule is a message processing engine. You can think of it as a giant conveyer belt. You put something on one end, and it goes along the belt and comes out the other end.
The thing that mule deals with are called messages.
The starting point is the "inbound end point" and the exit point is the "outbound end point"; between these pairs of end points you can have other things that will process the message as it travels from the start to the end.
A combination of a start end point + gubbins in the middle to do some work on the message + outbound end point is called a flow. You can chain flows together to create a workflow or process.
These processes are then packaged as an application and uploaded to the mule server. The process only runs when a message that it is listening for arrives. Otherwise the processes are sitting idle. Think of it like a car assembly line. The assembly line that fixes the seats in the car can only start when the chassis is finished; otherwise there is nothing for it to do. Once the seats are fixed, only then can the paint assembly line start, and so on.
Inbound Endpoint: To get the data in mule app from outside.
Outbound Endpoint: To pass the data from the mule app to the outside.
There are two types of connectors available based on operation.
Inbound Endpoint based connector : Inbound endpoint based connectors are the connectors which is placed inside a message
source area of a mule flow which is used to start executing or
triggering off the flow upon receiving the request. (or which is
used to receive the incoming request and pass the request to the
next message processors in a flow for further processing)
Outbound Endpoint or Process based connector: Outbound Endpoint based connectors are placed anywhere within a message processor
area of a flow at beginning or in the middle or at the end.
Regards,
Rajnish
Giving below the structure definition of Mule Message Object has Message Inbound Property Outbound Property Payload Variable Flow Variable Session Variable Attachment Exception Payload
When a connector of a flow (listening on a port) receives the payload its called Inbound endpoint. When in a flow we have a connectore placed in the middle and send a payload its called Oubound endpoint. Here the all the outbound properties sent to the Http Outbound flow become Inbound Properties within that flow.
For detailed explanation see the link below.
https://docs.mulesoft.com/mule-user-guide/v/3.8/mule-message-structure.

Cross-message state in Mule ESB

I need to create an "accumulator" service to be used by Mule ESB applications.
This service will hold inbound messages until a certain number are received and then package those messages into a single outbound message.
This is the first time I've needed to write an ESB application that needs to maintain state (the collection of previously received messages) across inbound messages and I'm not quite sure how to get started.
I think what I need is a place to hang a reference to a data structure that holds my lists of inbound messages, but I'm not sure.
What's the best (most productive, most consistent with ESB best-practices) mechanism for managing "application-level" (i.e. cross-message) state data?
Thanks.
For this scenario you need to use the aggregator pattern. Please follow the below link .
http://www.mulesoft.org/documentation-3.2/display/32X/Message+Splitting+and+Aggregation