pipeline array. Stages execute in order, one after another, within each workflow execution. Each stage can build a payload from scratch or inherit the previous stage’s payload, apply field assignments, mutate shared workflow state, and optionally dispatch the resulting event to your broker. Together, a sequence of stages lets you model realistic multi-event flows — from a single produce operation to complex conditional loops.
Complete Stage Example
The following stage builds anorder.item.added event, conditionally emits it only when the item price is positive, increments a state counter, and waits one second after dispatching before the next stage begins:
Field Reference
A unique identifier for this stage within the workflow. Used in logs and error messages. Choose a descriptive slug such as
"build-order" or "add-line-item".The logical name of the event this stage produces, for example
"order.created" or "payment.authorised". This label appears in the run’s event log and is used to match against schema definitions.Overrides the workflow-level
schemaId for this stage only. Use this when one stage produces a structurally different event from the workflow default. See Schemas for details.Controls where the stage’s initial payload comes from before
set assignments are applied."none"— start with an empty payload object."previous-stage"— copy the payload produced by the immediately preceding stage and modify it.
Repeat this stage a fixed number of times within a single execution. The stage’s
set, state, and emit logic runs on every iteration. Use alongside state mutations to produce sequences of related events.A DSL expression evaluated before each iteration. The stage keeps repeating as long as the expression resolves to
true. The stage does not execute at all if the condition is false on the first check.A DSL expression evaluated after each iteration. The stage repeats until the expression resolves to
true, meaning the stage body always executes at least once.Controls whether this stage dispatches its event to the broker.
true— always emit.falseor omitted — never emit; the stage runs itssetandstatelogic but does not publish.- An expression object — emit conditionally based on payload or state values.
A duration string that pauses execution after the stage body runs and before the next stage begins. Use this to simulate realistic inter-event timing in your consumer tests.The supported suffixes are:
| Value | Duration |
|---|---|
"500ms" | 500 milliseconds |
"1s" | 1 second |
"30s" | 30 seconds |
"1m" | 1 minute |
wait is skipped when running a workflow in simulation mode, so your pipeline logic can be validated quickly without real delays.Assigns values to fields in the event payload. Keys are dot-notation field paths; values are literals or DSL expressions.
Mutates the workflow-scoped state object. Uses the same key-value syntax as
set. Changes made here are visible to all subsequent stages in the same execution.Free-form string key-value pairs attached as message headers to the dispatched event. Useful for routing metadata, schema version stamps, or correlation IDs.
(Kafka only) The Kafka message key. Accepts the same value syntax as
set fields, including DSL expressions. Use this to control partition assignment.Runs a MongoDB lookup and stores the result in workflow state before the stage’s
set logic runs. Useful for seeding payloads from real data.Fields:| Field | Description |
|---|---|
connection | Name of the MongoDB connector |
database | Database name |
collection | Collection name |
find | MongoDB filter document |
select | Fields to project |
Configures Protobuf binary framing when
contentType is "application/x-protobuf". See the Schemas page for wire-format details.Repeat Patterns
Fixed repeat
Userepeat when you know exactly how many iterations you need:
Loop with repeatWhile
The condition is checked before each iteration. The stage does not execute if the condition is false from the start:
Loop with repeatUntil
The condition is checked after each iteration, so the stage always executes at least once:
Conditional Emit
Setemit to a $fn expression to publish events selectively. The engine evaluates the expression after set assignments are applied, so you can gate on freshly computed payload fields:
total of 100 or more are dispatched to the broker.
Pacing with wait
Use wait to introduce realistic timing between events, for example simulating a user journey where each action is seconds apart:
Next Steps
- Expressions — the full reference for
$fn,$ref,$path, and conditional values