Parallel Outputs (Fan-Out)
Connecting one node's output port to multiple downstream nodes — all branches receive the same output data and execute in parallel.
What Is Fan-Out?
Fan-out occurs when a single output port has multiple edges leading to different downstream nodes. The engine fires all those edges simultaneously, launching all target nodes in parallel. Each downstream node receives the same output data from the source node via $output.{sourceId}.
┌─────────────┐
│ FetchOrder │
└──────┬──────┘
│ (main port — 3 edges)
┌─────────┼─────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│SendEmail │ │LogAudit │ │UpdateERP │
└──────────┘ └──────────┘ └──────────┘
Each node reads: $output.FetchOrder.orderId, .total, etc.
All Branches Get the Same Data
The output object is written once to ExecutionMemory. All parallel branches read from the same location — there is no duplication of data, and no branch can mutate another branch's view of the output.
Scheduling Model
The engine uses a task queue to schedule parallel nodes. When fan-out occurs:
- The source node completes and its output is written to memory
- All edge targets are enqueued as independent execution tasks
- The task runner picks them up concurrently (up to the configured parallelism limit)
- Each branch executes independently with its own stack frame, but shared
ExecutionMemory
Joining Parallel Branches
To synchronize after fan-out, use a Join Gateway node. It waits until all incoming branches have completed before firing its output port. The join gateway merges all branch outputs into $output.joinGateway.branches:
// After a join gateway that waited for SendEmail, LogAudit, UpdateERP:
$output.joinGateway.branches.SendEmail.success // true/false
$output.joinGateway.branches.LogAudit.auditId // "audit-xyz"
$output.joinGateway.branches.UpdateERP.erpRef // "erp-001"
Parallel Fan-Out vs. Loop
| Pattern | Use When | Node |
|---|---|---|
| Fan-out | Fixed number of parallel tasks known at design time | Multiple edges from one port |
| Loop (iteration) | Dynamic number of items to process (array) | ForEach / Loop node |
ExecutionMemory. If two branches both write to the same variable (e.g., via a SetVariable node with the same key), a race condition may occur. Design branches to write to distinct variable names or use the Join Gateway to merge results safely.
Fan-Out with Edge Conditions
You can combine fan-out with edge conditions to create selective parallel branches. Some downstream nodes only activate if their edge condition is true:
// Edge 1: always fires (no condition)
// Edge 2: only if order total > 1000
$output.FetchOrder.total > 1000
// Edge 3: only if customer is VIP
$output.FetchOrder.customerTier === "vip"