domain event

A record that something meaningful happened in the business, such as an order being created, sent so other services can react.

In more detail

Events are named in the past tense and carry an ID for deduplication. With the outbox pattern they are stored in the same transaction as the change they describe.

Example

type DomainEvent = { type: "REGISTER"; email: string } | { type: "PAYMENT"; amount: number }, routed by an exhaustive switch on event.type

Related terms

Taught in

References