Accessing and Modifying Mule Events10% of the exam
Reading and replacing the Mule event payload
How the Mule 4 event splits into a message (payload and attributes) and variables, how Set Payload, Transform Message, operations and the Logger affect the payload, and how DataWeave selectors, `#[ ]` delimiters and the `.^mimeType` metadata selector decide what a flow outputs.
Apply correct processors/DataWeave expressions to access and modify Mule event payloads, and predict outcomes.
~7 min read · 8 practice questions ·
What the exam expects
- Describe the Mule 4 event: a message holding the payload and attributes, plus variables that sit outside the message.
- Predict the payload after Set Payload, a Logger, or a connector operation without a target, given a short XML flow.
- Write Set Payload values correctly: a literal string versus a
#[ ]DataWeave expression, and an output directive instead ofmimeTypewhen the expression must produce JSON. - Choose Set Payload for simple selections and Transform Message for complex transformations.
- Predict DataWeave selector results on the payload: single-value on an object or an array, index, and the
.^mimeTypemetadata selector. - Key terms: Mule event (message plus variables); Mule message (payload plus attributes, immutable); payload (the body, read with
payload); Set Payload (Core transformer that replaces the payload); selector (DataWeave syntax that returns matching values); metadata selector (.^name, returns metadata such as the MIME type instead of content).
Key facts
Event parts
- Detail
- A Mule message (payload + attributes) plus variables
Immutability
- Detail
- Each processor that receives a message returns a new Mule message
Set Payload fields
- Detail
- Value required; Mime Type and Encoding optional
mimeType on Set Payload- Detail
- Does not affect a DataWeave value; transformation needs an explicit output directive
Complex transformations
- Detail
- Use Transform Message, not Set Payload
Expression syntax in Studio
- Detail
#[payload]in Anypoint Studio; barepayloadonly in Design Center
Logger
- Detail
- Writes to the log (Console in Studio); default level
INFO
Single-value selector on an array
- Detail
- Applies to every object in the array and returns an array
No matching key
- Detail
- Single-value selector returns
null
Metadata selector
- Detail
.^mimeTypereturns the MIME type of a payload, variable or attribute
vars- Detail
- Holds only variables set on the event, read as
vars.myVar
Sources for this section (7)
- Mule Event Structuredocs.mulesoft.com (opens in a new tab)
- Mule Message Structuredocs.mulesoft.com (opens in a new tab)
- Set Payload Transformerdocs.mulesoft.com (opens in a new tab)
- Set Variable Transformerdocs.mulesoft.com (opens in a new tab)
- Logger Componentdocs.mulesoft.com (opens in a new tab)
- DataWeave Selectorsdocs.mulesoft.com (opens in a new tab)
- Predefined Variablesdocs.mulesoft.com (opens in a new tab)
- When does the component after an operation receive the same message the operation received?
- Why are Transform Message and Set Payload listed in different groups on the Core Components page?
- What does
payload.namereturn for[{"name": "Arg"}, {"name": "Japan"}]? - Which level does a Logger use by default?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the MuleSoft Developer pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 40 lessons of the MuleSoft Developer guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Practice exams purchase adds inline bank questions and topic practice (8 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams