Defining event-triggered workflows
Usetrigger_on_event to specify which topic should trigger the workflow:
Event payload structure
Event-triggered workflows receive the event in their payload:Publishing events
Publish events from workflows or external systems:From within a workflow
From external systems (API)
Batch events for processing
Process multiple events together for efficiency:- Workflow triggers when either
batch_sizeis reached orbatch_timeout_secondselapses - If 10 events arrive in 5 seconds → triggers immediately with 10 events
- If only 3 events arrive in 30 seconds → triggers with 3 events after timeout
Multiple handlers for one topic
Multiple workflows can listen to the same topic:immediate-handlertriggers once per eventbatched-handlertriggers once per batch (up to 5 events or 60 seconds)
Event filtering
Filter events byevent_type:
Event topic patterns
Use topic hierarchies for organization:Key takeaways
- Event-triggered workflows execute automatically when events are published
- Use
trigger_on_eventto specify the topic - Publish events from workflows or external systems via API
- Batch events for efficiency with
batch_sizeandbatch_timeout_seconds - Multiple handlers can listen to the same topic