Routing Events8% of the exam
Choice router conditions and route order
Predict which Choice route runs from its DataWeave `when` expressions (first true wins, `otherwise` as the default), avoid String versus Number and Boolean comparison traps, and choose DataWeave `if`/`else` or the First Successful router when Choice is the wrong tool.
Apply correct processors/syntax to route messages using DataWeave conditions within a choice router, and predict outcomes.
~7 min read · 9 practice questions ·
What the exam expects
- Predict which route of a Choice router runs, given the
whenexpressions in their declared order and an input event. - Write the Mule 4 XML for a Choice router:
<choice>, one or more<when expression="#[...]">elements and an optional<otherwise>default route. - Spot DataWeave conditions that fail because of type: Strings from query parameters compared with Numbers, and
==versus~=against Booleans. - Predict the payload and variables after a route that calls a subflow.
- Choose DataWeave
if/elsewhen routes only differ in a value, and the First Successful router when the next route must run only after a failure.
Key terms:
- Choice router: runs exactly one route, chosen by DataWeave expressions.
whenroute: a routing option whoseexpressionholds the condition.- Default route: the
<otherwise>element, labelled Default in Studio, which runs when no expression istrue. - First Successful router: tries routes in order until one completes without an error.
~=: the DataWeave equality operator that coerces one operand to the other's type.
Key facts
Routes that run
- Detail
- Only one: the first
whenwhose expression istrue
Later expressions
- Detail
- Not checked once one is
true
No expression true
- Detail
- The default (
<otherwise>) route executes
<otherwise>- Detail
- Optional child of
<choice>; Studio labels it Default
Processors per route
- Detail
- Any number in each
whenandotherwise
Condition language
- Detail
- DataWeave, in the
expressionattribute
Mixed-type relational operands
- Detail
- Right operand coerced to the left operand's type
"true" == true vs "true" ~= true- Detail
falsevstrue
DataWeave
if- Detail
- Every
ifmust have a matchingelse
First Successful
- Detail
- Next route runs only after an error; error if none succeed
- What does
('1' ~= 1)return, and why? - Why does a new Choice router in Studio already show two routes?
- When does the
else ifbranch of a DataWeaveifsupply the value?
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 (9 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams