Rendering diagram…
Use fan-out/fan-in when:
Rendering diagram…
Fan-Out: Split the input into individual items and launch parallel processing for each.
Fan-In: Wait for all parallel branches to complete, then combine the results.
Get the list of items to process:
For each item in the collection, spin up an independent processing branch. Two approaches:
Approach A: Loop with child workflows
Approach B: Parallel branches (fixed count)
Each parallel branch does the same work:
Wait for all branches to complete, then:
Not all items will succeed. Design for this:
| Scenario | Strategy |
|---|---|
| 1 of 50 items fails | Log the failure, continue with the other 49 |
| Half the items fail | Complete what you can, send a summary of failures |
| All items fail | Abort and alert — likely a systemic issue |
Fan-Out:
Fan-In: 3. Wait for all 50 child workflows to complete 4. Generate summary:
Be careful with concurrency limits. If you fan out to 100 parallel API calls but the target system only handles 10 concurrent requests, you'll trigger rate limits or timeouts. Use the Retry with Exponential Backoff pattern within each branch.
Model a business process as a set of defined states with explicit transitions between them. Unlike linear workflows, items can move forwards, backwards, and loop — matching how real business processes actually behave.