SlideShare a Scribd company logo
1 of 11
MULE MESSAGE
STRUCTURE
Shanky Gupta
Introduction
■ The Mule 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.
■ A Mule message is, itself, embedded within a Mule message object. Some
Mule message objects may contain variables, attachments, and exception
payloads. However, as attachments and exception payloads are not frequently
used or manipulated, this overview document does not include details about
them.
Properties andVariables
■ The metadata contained in the message header consists of properties which
provide useful information about the message. Contained within the message
object, variables represent data about a message.
■ Properties and variables share a common format: each individual property or
variable has a name and a value. The name is how you refer to the property or
variable in Mule, and the value is the information stored within it. Thus, the
name is like a key to a door and the value is the material behind the door.
■ A message’s properties and variables have specific scopes that define and
organize how they apply across that message’s lifecycle. Properties send
metadata along with a message in order to facilitate processing and avoid
errors when the message crosses the transport barrier – either by entering a
new flow or by being transmitted to another application.
Properties scope - inbound
■ Properties have two main scopes: inbound and outbound.
■ Inbound properties are immutable, are automatically generated by the message
source and cannot be set or manipulated by the user. They contain metadata specific
to the message source that prevents scrambling of data formats or other processing
mishaps later in the message’s lifecycle. A message retains its inbound properties only
for the duration of the flow; when a message passes out of a flow, its inbound
properties do not follow it (see image below).
Properties scope - outbound
■ Outbound properties are mutable; they are set during the course of a flow and can
become inbound properties when the message passes from the outbound endpoint of
one flow to the inbound endpoint of a different flow via a transport. They contain
metadata similar to that of an inbound property, but an outbound property is applied
after the message enters the flow. Outbound properties can be set automatically by
Mule or a user can set them by manually inserting one or more transformer elements
in the flow. Note that if the message is passed to a new flow via a flow-ref rather than
a connector, the outbound properties remain outbound properties rather than being
converted to inbound properties (see image below).
Variable scope
■ Variables are user-defined metadata about a message. Variables have
three scopes:
– Flow variables apply only to the flow in which they exist.
– Session variables apply across all flows within the same application.
– Record variables apply to only to records processed as part of a
batch.
■ Variables are temporary pieces of information about a message that are
meant to be used by the application that is processing it, rather than
passed along with the message to its destination. Thus, variables are
more likely to be set by humans, whereas properties are more likely to
be set and invoked by systems. However, there are no strict rules about
how properties and variables should be used.
Setting and Using Properties andVariables
■ Mule includes three message processors you can use to set, copy or remove
outbound properties and variables on a message in a flow. When you include
one of these transformers in your flow, Mule adds, copies or removes
metadata to the message header or object. (There is a fourth message
processor: the Record Variable Transformer can set or remove variables on a
record in a batch. This section, however, focuses only on message processors
which act upon messages.)
■ For example, you may want to add a property to a message to set an HTTP
transport header on your message. Alternatively, if your flow looks up an
account number associated with a user, you may want to add a variable to
your message to store the account number as metadata on the message. The
table below describes these three message processors: Property
Transformer,VariableTransformer, and SessionVariableTransformer.
Message Payload
■ The message payload is the most important part of the Mule message
because it contains the data your Mule application processes. You may apply
metadata in the message header or message object to communicate
information about your message or secure it from being tampered with, but
the core of the message – the data you are transporting – is the reason the
message exists in the first place.
■ The payload doesn’t necessarily stay the same as it travels through a flow.
Various message processors in a Mule flow can affect the payload along the
way by setting it, enriching, or transforming it into a new format. You can also
extract information from a payload within a flow using a MEL expression.
Setting a Message Payload
■ Use a Set Payload message processor to completely replace the content of the
message’s payload. Enter a literal string or a Mule expression that defines the
new payload that Mule should set. The following example replaces the payload
with a string that reads "Hello, my friend!".
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking……>
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081"
doc:name="HTTP Listener Configuration"/>
<flow name="setting_propertiesFlow3" doc:name="setting_propertiesFlow3">
<http:listener config-ref="HTTP_Listener_Configuration" path="replace“
doc:name="HTTP"/>
<set-payload value=""#['Hello, my friend!']"" doc:name="Set Payload"/>
</flow>
</mule>
Enriching a Message Payload
■ In some cases, you may wish to call an external resource and use the
response to enrich the message payload, rather than replace it. To do
so, you can use a Message Enricher scope (or wrapper) to encapsulate
one or more message processors which perform the task of fetching the
information. Once obtained, Mule adds to, or enriches, the message
payload with the result of the call to the resource.

More Related Content

What's hot

Mule ESB Tutorial Part 3
Mule ESB Tutorial Part 3Mule ESB Tutorial Part 3
Mule ESB Tutorial Part 3
Srikanth N
 

What's hot (20)

Mule esb transformers
Mule esb transformersMule esb transformers
Mule esb transformers
 
Mule ESB Tutorial Part 3
Mule ESB Tutorial Part 3Mule ESB Tutorial Part 3
Mule ESB Tutorial Part 3
 
File component in mule
File component in muleFile component in mule
File component in mule
 
Routing in mule
Routing in muleRouting in mule
Routing in mule
 
mulesoft filters
mulesoft filtersmulesoft filters
mulesoft filters
 
Rabbit Mq in Mule
Rabbit Mq in MuleRabbit Mq in Mule
Rabbit Mq in Mule
 
Mule technology
Mule technologyMule technology
Mule technology
 
Dataweave in studio
Dataweave in studioDataweave in studio
Dataweave in studio
 
Mule concepts elements in a mule flow
Mule concepts elements in a mule flowMule concepts elements in a mule flow
Mule concepts elements in a mule flow
 
Choice router mule
Choice router   muleChoice router   mule
Choice router mule
 
Design flows in mule
Design flows in muleDesign flows in mule
Design flows in mule
 
Mule esb parts
Mule esb partsMule esb parts
Mule esb parts
 
Mule Complete Training
Mule Complete TrainingMule Complete Training
Mule Complete Training
 
Muleflowarchitecture
MuleflowarchitectureMuleflowarchitecture
Muleflowarchitecture
 
Mule high availability
Mule high availabilityMule high availability
Mule high availability
 
Mule healthcare toolkit
Mule healthcare toolkitMule healthcare toolkit
Mule healthcare toolkit
 
Implementing an Esb using Mule
Implementing an Esb using MuleImplementing an Esb using Mule
Implementing an Esb using Mule
 
Mule Collection Aggregator
Mule Collection AggregatorMule Collection Aggregator
Mule Collection Aggregator
 
Mule ESB Components
Mule ESB Components Mule ESB Components
Mule ESB Components
 
Mule rabbitmq
Mule rabbitmqMule rabbitmq
Mule rabbitmq
 

Viewers also liked

VYATTA USERS MEETING Spring 2014
VYATTA USERS MEETING Spring 2014VYATTA USERS MEETING Spring 2014
VYATTA USERS MEETING Spring 2014
Hiroyasu Suzuki
 

Viewers also liked (20)

Mule message structure
Mule message structureMule message structure
Mule message structure
 
Configuring Anypoint Studio MQ connector
Configuring Anypoint Studio MQ connectorConfiguring Anypoint Studio MQ connector
Configuring Anypoint Studio MQ connector
 
Invoke component
Invoke componentInvoke component
Invoke component
 
Logger
LoggerLogger
Logger
 
Cloud hub architecture
Cloud hub architectureCloud hub architecture
Cloud hub architecture
 
OAuth 2.0 authentication
OAuth 2.0 authentication OAuth 2.0 authentication
OAuth 2.0 authentication
 
Cloudhub fabric
Cloudhub fabricCloudhub fabric
Cloudhub fabric
 
Mule tcat server - Server profiles
Mule tcat server - Server profilesMule tcat server - Server profiles
Mule tcat server - Server profiles
 
MUnit run and wait scope
MUnit run and wait scopeMUnit run and wait scope
MUnit run and wait scope
 
VYATTA USERS MEETING Spring 2014
VYATTA USERS MEETING Spring 2014VYATTA USERS MEETING Spring 2014
VYATTA USERS MEETING Spring 2014
 
Using mule with web services
Using mule with web servicesUsing mule with web services
Using mule with web services
 
CloudHub networking guide
CloudHub networking guideCloudHub networking guide
CloudHub networking guide
 
Java-JSON-Jackson
Java-JSON-JacksonJava-JSON-Jackson
Java-JSON-Jackson
 
Java component
Java componentJava component
Java component
 
Mule message
Mule messageMule message
Mule message
 
Web services
Web servicesWeb services
Web services
 
Mule_Portal
Mule_PortalMule_Portal
Mule_Portal
 
Mule esb domain
Mule esb domainMule esb domain
Mule esb domain
 
Mule Cloud Connectors-Save and Load OAuth
Mule Cloud Connectors-Save and Load OAuthMule Cloud Connectors-Save and Load OAuth
Mule Cloud Connectors-Save and Load OAuth
 
MMC
MMCMMC
MMC
 

Similar to Mule message structure (20)

Message structure
Message structureMessage structure
Message structure
 
Mule message
Mule messageMule message
Mule message
 
Mule message
Mule messageMule message
Mule message
 
Mule architecture
Mule   architectureMule   architecture
Mule architecture
 
Mule architecture
Mule   architectureMule   architecture
Mule architecture
 
Mule chapter2
Mule chapter2Mule chapter2
Mule chapter2
 
Mule concepts
Mule conceptsMule concepts
Mule concepts
 
Elements in a mule flow
Elements in a mule flowElements in a mule flow
Elements in a mule flow
 
Elements in a muleflow
Elements in a muleflowElements in a muleflow
Elements in a muleflow
 
Mule fundamentals
Mule fundamentalsMule fundamentals
Mule fundamentals
 
Srilekha mule esb
Srilekha mule esbSrilekha mule esb
Srilekha mule esb
 
Message structure
Message structureMessage structure
Message structure
 
Message state
Message stateMessage state
Message state
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule esb
Mule esbMule esb
Mule esb
 
How to use attachment transformer
How to use attachment transformerHow to use attachment transformer
How to use attachment transformer
 
Mule esb naveen
Mule esb naveenMule esb naveen
Mule esb naveen
 
Niranjan mule esb
Niranjan mule esbNiranjan mule esb
Niranjan mule esb
 
Mule slides
Mule slides Mule slides
Mule slides
 
Mule esb kranthi
Mule esb kranthiMule esb kranthi
Mule esb kranthi
 

More from Shanky Gupta

More from Shanky Gupta (20)

Mule tcat server - common problems and solutions
Mule tcat server - common problems and solutionsMule tcat server - common problems and solutions
Mule tcat server - common problems and solutions
 
Anypoint access management - Roles
Anypoint access management - RolesAnypoint access management - Roles
Anypoint access management - Roles
 
Mule access management - Managing Environments and Permissions
Mule access management - Managing Environments and PermissionsMule access management - Managing Environments and Permissions
Mule access management - Managing Environments and Permissions
 
Mule: Munit domain support
Mule: Munit domain supportMule: Munit domain support
Mule: Munit domain support
 
Mule tcat server - Monitoring a server
Mule tcat server - Monitoring a serverMule tcat server - Monitoring a server
Mule tcat server - Monitoring a server
 
Mule tcat server - Monitoring applications
Mule tcat server - Monitoring applicationsMule tcat server - Monitoring applications
Mule tcat server - Monitoring applications
 
Mule tcat server - deploying applications
Mule tcat server - deploying applicationsMule tcat server - deploying applications
Mule tcat server - deploying applications
 
Mule tcat server - automating tasks
Mule tcat server - automating tasks Mule tcat server - automating tasks
Mule tcat server - automating tasks
 
Mule agent notifications
Mule agent notificationsMule agent notifications
Mule agent notifications
 
Mule management console Architecture
Mule management console ArchitectureMule management console Architecture
Mule management console Architecture
 
MUnit matchers
MUnit matchersMUnit matchers
MUnit matchers
 
MuleSoft CloudHub FAQ
MuleSoft CloudHub FAQMuleSoft CloudHub FAQ
MuleSoft CloudHub FAQ
 
Mule management console
Mule management consoleMule management console
Mule management console
 
Cloudhub and Mule
Cloudhub and MuleCloudhub and Mule
Cloudhub and Mule
 
Mule Security
Mule SecurityMule Security
Mule Security
 
Anypoint access management - Users
Anypoint access management - UsersAnypoint access management - Users
Anypoint access management - Users
 
Anypoint access management
Anypoint access management Anypoint access management
Anypoint access management
 
The Mule Agent
The Mule AgentThe Mule Agent
The Mule Agent
 
MUnit - Testing Mule
MUnit - Testing MuleMUnit - Testing Mule
MUnit - Testing Mule
 
Mule testing
Mule testingMule testing
Mule testing
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 

Mule message structure

  • 2. Introduction ■ The Mule 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. ■ A Mule message is, itself, embedded within a Mule message object. Some Mule message objects may contain variables, attachments, and exception payloads. However, as attachments and exception payloads are not frequently used or manipulated, this overview document does not include details about them.
  • 3. Properties andVariables ■ The metadata contained in the message header consists of properties which provide useful information about the message. Contained within the message object, variables represent data about a message. ■ Properties and variables share a common format: each individual property or variable has a name and a value. The name is how you refer to the property or variable in Mule, and the value is the information stored within it. Thus, the name is like a key to a door and the value is the material behind the door. ■ A message’s properties and variables have specific scopes that define and organize how they apply across that message’s lifecycle. Properties send metadata along with a message in order to facilitate processing and avoid errors when the message crosses the transport barrier – either by entering a new flow or by being transmitted to another application.
  • 4. Properties scope - inbound ■ Properties have two main scopes: inbound and outbound. ■ Inbound properties are immutable, are automatically generated by the message source and cannot be set or manipulated by the user. They contain metadata specific to the message source that prevents scrambling of data formats or other processing mishaps later in the message’s lifecycle. A message retains its inbound properties only for the duration of the flow; when a message passes out of a flow, its inbound properties do not follow it (see image below).
  • 5. Properties scope - outbound ■ Outbound properties are mutable; they are set during the course of a flow and can become inbound properties when the message passes from the outbound endpoint of one flow to the inbound endpoint of a different flow via a transport. They contain metadata similar to that of an inbound property, but an outbound property is applied after the message enters the flow. Outbound properties can be set automatically by Mule or a user can set them by manually inserting one or more transformer elements in the flow. Note that if the message is passed to a new flow via a flow-ref rather than a connector, the outbound properties remain outbound properties rather than being converted to inbound properties (see image below).
  • 6. Variable scope ■ Variables are user-defined metadata about a message. Variables have three scopes: – Flow variables apply only to the flow in which they exist. – Session variables apply across all flows within the same application. – Record variables apply to only to records processed as part of a batch. ■ Variables are temporary pieces of information about a message that are meant to be used by the application that is processing it, rather than passed along with the message to its destination. Thus, variables are more likely to be set by humans, whereas properties are more likely to be set and invoked by systems. However, there are no strict rules about how properties and variables should be used.
  • 7. Setting and Using Properties andVariables ■ Mule includes three message processors you can use to set, copy or remove outbound properties and variables on a message in a flow. When you include one of these transformers in your flow, Mule adds, copies or removes metadata to the message header or object. (There is a fourth message processor: the Record Variable Transformer can set or remove variables on a record in a batch. This section, however, focuses only on message processors which act upon messages.) ■ For example, you may want to add a property to a message to set an HTTP transport header on your message. Alternatively, if your flow looks up an account number associated with a user, you may want to add a variable to your message to store the account number as metadata on the message. The table below describes these three message processors: Property Transformer,VariableTransformer, and SessionVariableTransformer.
  • 8.
  • 9. Message Payload ■ The message payload is the most important part of the Mule message because it contains the data your Mule application processes. You may apply metadata in the message header or message object to communicate information about your message or secure it from being tampered with, but the core of the message – the data you are transporting – is the reason the message exists in the first place. ■ The payload doesn’t necessarily stay the same as it travels through a flow. Various message processors in a Mule flow can affect the payload along the way by setting it, enriching, or transforming it into a new format. You can also extract information from a payload within a flow using a MEL expression.
  • 10. Setting a Message Payload ■ Use a Set Payload message processor to completely replace the content of the message’s payload. Enter a literal string or a Mule expression that defines the new payload that Mule should set. The following example replaces the payload with a string that reads "Hello, my friend!". <?xml version="1.0" encoding="UTF-8"?> <mule xmlns:tracking……> <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration"/> <flow name="setting_propertiesFlow3" doc:name="setting_propertiesFlow3"> <http:listener config-ref="HTTP_Listener_Configuration" path="replace“ doc:name="HTTP"/> <set-payload value=""#['Hello, my friend!']"" doc:name="Set Payload"/> </flow> </mule>
  • 11. Enriching a Message Payload ■ In some cases, you may wish to call an external resource and use the response to enrich the message payload, rather than replace it. To do so, you can use a Message Enricher scope (or wrapper) to encapsulate one or more message processors which perform the task of fetching the information. Once obtained, Mule adds to, or enriches, the message payload with the result of the call to the resource.