working with messages in mule

When using mule, it is very common to set and access variables, sessions variable and property along our flow. What are the differences between :-

a) variable - data that exist and last from start to end of a flow unless over-written. Accessed using #[flowVars]

c) session - a lasting location for storing values. Accessed by using #[sessionVars]

d) property - are message header information

e) message payload - is the mule message sent to user and move from flow to flow. It could made up of message inflow (accessed using #[message.inboundProperties] and message outflow #[message.outboundProperties].

f) message events

The best way to test this out is to create a flow that makes use of these basic mule construct.

Let's start off with variable. From the flow below we grab input from http and save it to a variable. Then we create a choice flow to see if the variable is "reece". If yes, branch up and set result to 111, else 222.

If we have a look at the "set variable" we obtain value from http

And finally for the choice,

Once we have all these component wired up, just run http://localhost:3001/?username=reece,

This article purpose is to show you how to work with variables / messages in a mule flow. Understanding how to get the value and performing if/then/else construct is key.


Popular posts from this blog

Solving Sonarqube :- Project was never analyzed. A regular analysis is required before a branch analysis

spark - pyspark reading from excel files