BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
179 / 1048 · Module 6 — Mule Routing and Orchestration← prev⊞ allnext →

6.10Variables inside loops

Suppose you want to count failures.

Conceptually:

vars.failureCount = 0

For Each
    ↓
process item
    ↓
if failed
   increment failure count

However, mutable state becomes trickier when parallelism enters the picture.

That's one reason to avoid casual use of shared variables in concurrent processing.