Domain events

The domain event pattern is a preferred a way to trigger side effects across multiple aggregates within the same domain. A domain event is an event that occurs in a particular domain, which the other parts of the same domain (subdomain) should also be aware of and may need to react to it as well.

A domain event pattern helps to do the following:

  • Express the side effects of an event in a domain explicitly
  • Maintain consistency of the side effects (either all the operations related to the business task are performed or none of them are)
  • Enable a better separation of concerns among classes within the same domain

Get Architectural Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.