We've introduced event processing domains, a powerful routing system that enables sophisticated workflow patterns including human-in-the-loop operations, external system integrations, and custom processing pipelines.
What's New
Events can now be categorized into processing domains using the new domains
parameter when emitting. Events without explicit domains automatically use the 'default' domain. Multi-domain events participate in multiple processing flows simultaneously - perfect for workflows that need both standard processing and external approval, or events that trigger analytics while routing to audit systems.
The orchestrator's execute()
method returns enhanced data: allEventDomains
lists all unique domains used, and domainedEvents
contains domain-segregated event buckets. The familiar events
array remains for backward compatibility.
Breaking Change
All event handlers now return an object instead of an array:
Standard Event Handlers:
const events = await handler.execute(event)
const { events } = await handler.execute(event)
Orchestrators:
const events = await orchestrator.execute(event)
const { events, allEventDomains, domainedEvents } = await orchestrator.execute(event)
Using Domains
Add domains: ['external']
to emit calls for external processing. Access domain-specific events via result.domainedEvents[domainName]
or all events via result.domainedEvents.all
. Existing code works unchanged once you update the destructuring pattern.