Are you an LLM? You can read better optimized documentation at /guide/event.md for this page in Markdown format
Events and Collaboration
After a domain event enters EventStore, it is authoritative history. The downstream collaboration in this section runs after the append. It consumes committed facts, but its effects are not part of the source aggregate transaction and cannot roll back an appended event.
Choose the collaboration mechanism by goal before opening its implementation and failure boundaries.
Choose a Processing Mechanism
| Need | Choose | Responsibility boundary |
|---|---|---|
| Ordinary side effects such as notifications, audit, cache invalidation, or external integration | Processor | Invoke matching functions; the side effect owns idempotency and recovery |
| An event must generate cross-aggregate follow-up commands | Saga | Map the event to 0..N commands and cross the command-send boundary |
| A failed processing function needs durable recording, scheduling, and replay | Event Compensation | Persist failure-recovery state; it does not express a business reverse action |
| Maintain a query read model | Projection | Own only the read model, not ordinary integrations or cross-aggregate orchestration |
Choose from the required business result, not from annotation names. One flow may use several branches, but their completion signals remain independent.
Typical Collaboration Path
text
command -> aggregate -> append domain event
|-> Processor -> ordinary side effect
|-> Saga -> 0..N follow-up commands
`-> processing failure -> Compensation- The source event is already committed; a downstream failure is not an EventStore rollback.
EVENT_HANDLEDmeans only that the matching Processor function completed.SAGA_HANDLEDmeans only that the matching Saga function completed and its command sends completed; it does not mean those commands were processed.- For caller-visible waiting at these stages, see Completion Semantics.
Reading Order
- Start with Event Processor for ordinary application or integration side effects.
- Read Saga when an event must drive other aggregates.
- When a processing failure needs durable recovery, continue to Event Compensation.