Appearance
Fork
Runs the connected branch on its own background task for every input record and returns at once, so the caller does not wait for the downstream processing. Use it to decouple a slow branch from a fast producer (for example answer an HTTP request and process the data in the background) or to process records in parallel with a limit.
Pins
| Pin | Kind | Types | Description |
|---|---|---|---|
| Input | input | any | Records to process in the background. |
| Output | output | same as input | The unchanged record, emitted on a background task with its own copy of the metadata. |
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
MaxParallelTasks | integer (1-1024) | 8 | Maximum number of branches running at the same time. A slot is held until the branch has finished. |
MaxWaitTime | integer (seconds, ≥ 0) | 0 | How long an input waits for a free slot. 0 = wait indefinitely. |
Behaviour
- For each record the Fork waits for a free slot (backpressure: the caller waits while all
MaxParallelTasksbranches are busy), starts a task that sends the record toOutput, and returns. The slot is released when the branch has finished. - No free slot within
MaxWaitTime: the record fails with a recoverable error (code503) at the Fork, so the caller's error handling sees it. - Every branch gets its own copy of the metadata (attachments, exception scope, batch), so parallel branches don't affect each other or the caller.
- An error in a branch is passed to the flow's error handling with the branch metadata: it reaches the innermost Try catch around the Fork, else the flow's error log.
- Batches: a branch keeps the record's batch open until the branch has finished, so batch consumers behind the Fork commit only after the last forked branch of that batch.
- Transactions: branches run outside an open Sql transaction (a transaction around the Fork commits without waiting for them and is never used by them).
- The Fork keeps the flow running (KeepAlive), so background work can complete.
Notes
- The order in which records are processed downstream is not guaranteed.
- When the flow stops, running branches are cancelled with the flow; they are not awaited. Records still waiting for a slot are dropped.
- With
MaxWaitTime=0a stuck downstream system blocks the caller once all slots are busy; set a wait time to fail fast instead.
Example
json
{ "MaxParallelTasks": 8, "MaxWaitTime": 30 }Http listener → Http response (202) → Fork → Http client (slow API) → Database writer