MULE 4 – MESSAGE STRUCTURE and Anypoint Studio

Join our 2nd session of MuleSoft Developing API’s session. In this session will talk about Mule 4 Message Structure and Anypoint Studio. We will also learn about MuleSoft Project Structure, Flow , Sub Flow & Private flow, Connectors and Http Listener , Set Payload connectors.

YouTube video

Mule 4 – Message Structure

A Mule 4 message is like an envelope that contains a letter (payload), some information on the outside (attributes), sticky notes (variables) you can attach, and a place to write down any problems that might occur (error information). All of these components work together to help you process and manage data in your Mule 4 application.

  • Mule Event = Mule Message + Variables (Error Information).
  • Mule Message = Payload + Attributes

Mule Event & Message Structure

  • Payload : It’s the actual message content. Payload can be over ridden.
  • Attributes: These provides metadata information such as queryParams, uriParams ,file size etc . These are immutable (cannot be changed)
  • Variables: These are which you can store some kind of data or information and can be used across the application as long as you connect the flows with flow-ref .
  • Error Information : In case any error occurs in the application, an error object is produced which contains all the information related to the error

Mule Project Structure

  • Every Project in Mule 4 is Mavenized Project (pom.xml)
  • All Mule xml’s are placed under src/main/mule
  • Other files can be placed under : src/main/resources or src/test/resources
  • mule-artifact.json
  • Each Mule app xml has – Message flow (Graphical view) , Global elements(contains all config details) ,configuration xml (xml version of graphical view)

Flow , Sub-flow & Private Flow

  • An App can consists of a single flow !
  • Or it can break up processing into discrete(private) flows and sub flows that you add to the app and connect together.
  • Private and sub-flows can be triggered by Flow-reference or by DataWeave lookup!


A flow has “Source” , “Process” and “Error Handling” Part. You should definitely keep something in Source.


A private flow has “Source” , “Process” and “Error Handling” Part. It’s called a private flow when we don’t keep anything in Source Part.


A sub flow do not have “Source” and “Error Handling” Part. It has only Process Part. Error Handling for sub-flows are handled by the calling flow/private flow.

HTTP Listener

  • Listens to the request which client/user sends.
  • Mandatory Config Details required: host , port , path
  • Default : Accepts all kind of Methods if nothing is specified

Set Payload

  • The Set Payload component lets you update the payload of the message.
  • The payload can be a literal string or a DataWeave expression
  • Mandatory Config Details required: value eg : #[“Hello World” ] or #[payload] or #[]
  • Default : #[payload]


Checkout our complete MuleSoft Training to learn all about MuleSoft. We have 15+ session for you with Final Project.

Amit Chaudhary
Amit Chaudhary

Amit Chaudhary is Salesforce Application & System Architect and working on Salesforce Platform since 2010. He is Salesforce MVP since 2017 and have 17 Salesforce Certificates.

He is a active blogger and founder of Apex Hours.

Articles: 460

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *