Domain event
Last updated
Last updated
From [[Domain-Driven Design]] ([[DDD]]).
A service often needs to publish events when it updates its data. These events might be needed, for example, to update a . Alternatively, the service might participate in an choreography-based , which uses events for coordination.
How does a service publish an event when it updates its data?
Organize the business logic of a service as a collection of DDD that emit domain events when they created or updated. The service publishes these domain events so that they can be consumed by other services.
The [[Saga]] and [[CQRS]] patterns create the need for this pattern
The [[Aggregate]] pattern is used to structure the business logic
The [[Transactional outbox]] pattern is used to publish events as part of a database transaction
[[Event sourcing]] is sometimes used to publish domain events
My book describes this pattern in a lot more detail.