Processing Records10% of the exam
For Each and Parallel For Each scopes
Predict the payload, variables and error behaviour after a For Each or Parallel For Each scope, configure `collection` and `batchSize`, and know when a Batch Job is the better tool.
Apply correct processors/syntax to process individual records in a collection using For Each scopes, and predict outcomes.
~8 min read · 8 practice questions ·
What the exam expects
- Configure a For Each scope's
collectionexpression so each element of a JSON or XML array becomes the payload inside the scope. - Predict the number of iterations and each iteration's payload for a given
batchSize. - Predict the payload and the variables after a For Each scope and after a Parallel For Each scope.
- Predict what happens when one element fails: For Each stops, Parallel For Each finishes every route and raises
MULE:COMPOSITE_ROUTING. - Choose a Batch Job over Parallel For Each when the input is too large to buffer in memory or must survive a redeployment.
Key terms:
- Collection: the expression that returns what the scope splits; the default is
payload. - Batch size: the size of each sub-collection For Each processes as one Mule message.
- Root message: the complete, non-split parent message, stored in a variable.
- Route: one parallel branch of Parallel For Each, processing one element.
Key facts
For Each output payload
- Detail
- Same as the input payload
collection default- Detail
payload; use a DataWeave expression for JSON or XML
batchSize default- Detail
1; 200 elements at 50 = 4 batches of 50
For Each variables
- Detail
- Changes persist across iterations and after the scope
For Each error
- Detail
- Stops processing the collection, invokes the error handler
Parallel For Each output
- Detail
- Collection of route results in pre-split order
Parallel For Each variables
- Detail
- Same set and values after the scope as before
Parallel For Each error
- Detail
- All routes finish, then
MULE:COMPOSITE_ROUTING
Batch Job reliability
- Detail
- Persistent queues; resumes after redeploy or crash
- What payload does the processor after a For Each scope receive?
- Why must the Collection field be set when the payload is a JSON object containing an array?
- Why is a counter incremented inside Parallel For Each unchanged after the scope?
- When should a Batch Job replace Parallel For Each?
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