Domain Events: Efficient System Adaptation

Explore how to implement domain events to manage system changes and side effects, separating event handling from triggering.

A domain event is a domain-driven design pattern that encapsulates a change in the system that is important to the domain experts. When important events happen in our system, they are often accompanied by rules or side effects. We may have a rule that when the OrderCreated event happens in our system, we send a notification to the customer.

If we put this rule into the handler for CreateOrder so that the notification happens implicitly, it might look something like this:

Get hands-on with 1400+ tech skills courses.