Skip to content

EmitSync Flow

TriggerSync fires an event and blocks until all matched runs finish or the wait budget expires. It subscribes directly to the NATS RESULTS stream using raw NATS — not a JetStream consumer — so there is nothing to ack. The subscription opens before dispatch, so a run that finishes immediately is never missed.

Ironflow emitSync flow

When the wait budget expires (30s by default), the handler reads each run from the database. A terminal row becomes a complete result. A non-terminal row retains its actual status and returns waitTimedOut: true; the durable run continues. If the NATS subscription cannot be created at all, the handler polls the database under the same budget.

emitSync() returns one result per matched run — EmitSyncResult[] in JavaScript, []EmitSyncResult in Go — and an event that matches nothing returns an empty list. For a single function by ID, InvokeFunctionSync is the one-run counterpart (ADR 0067). A function with debounce configured rejects TriggerSync: use the async Emit Flow instead.