An event handler receives an event and performs the associated processing. It can advance a choreography-based saga, carry out an asynchronous follow-up action, or update a CQRS view. section 10.1.2 section 6.2.4 section 13.3
In a choreography-based saga, services exchange events over channels. Events communicate operation outcomes and carry data between participants; inbound adapters handle them, while outbound adapters publish events. An outgoing event can be published by domain logic or by the handler for an incoming event. section 10.1.2
Order creation and notification
An order operation can publish an event to a message channel, allowing a notification handler to send a confirmation email separately. Order creation can then succeed even when the external email service is unavailable. section 6.2.4
Asynchronous handlers reduce runtime coupling to slow or unavailable external systems and can support scalable background processing. They also introduce more complexity than direct calls or the Observer pattern: event publication, duplicate messages, and transactions spanning multiple steps need careful design. Use the simpler collaboration mechanism when that complexity is not justified. section 6.2.4
In a CQRS view, an event handler typically delegates updates to a view repository; a query handler delegates queries to it. To ensure idempotency, the event handler must update the view and record the event ID atomically. Concurrent handlers must not corrupt a record they both update. section 13.3 section 13.3.1
Figure 10.2 The choreography-based implementation of the Create Order Saga consists of events, channels, event publishers, and event handlers
Follow the event handlers, publishers, and channels that coordinate the order saga. section 10.1.2




























