Fragment

Domain-Driven Design Distilled Notes - Chapter 6

Vernon (2016), on 6th chapter:

DDD - Domain Events

Domain events happen after something happened in your DDD - Bounded Contexts. They broadcast that something happened, so all contexts that listen to this event can act accordingly.

Best practices for domain events:

  • Add a timestamp (especially because the subscribers might not receive them synchronously)
  • Use DDD - Ubiquitous Language
  • When naming, use the past tense
  • Have enough data so everyone can act on it, but be careful not to be excessive

If it is important to reconstruct state by order of events, one should consider DDD - Event Sourcing

DDD - Event Sourcing

Event sourcing is the act of persisting all DDD - Domain Events, so we can reconstitute a certain state based on those records.

There are probably strict performance requirements here, so be mindful of throughput and load when doing it.