- Diagrams
- Flows
- EmitSync Flow
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 to catch early results; durable polling also covers lost notifications.
The handler reads durable run results immediately and then on a 100 ms cadence while waiting, alongside RESULTS notifications. Either a result message or a settled stored result can end a run’s wait; at most one store read per run is in flight. Storage latency can delay reads. If the subscription cannot be created, polling uses the same absolute wait budget (30s by default). When that budget expires, a non-terminal result retains its actual status and returns waitTimedOut: true; the durable run continues.
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.