liveBook · Manning

Domain event

As explained in Build High Value Software Systems

A record of a significant occurrence in a business domain that other parts of a system can respond to.

A domain event records something significant that has happened in a business domain. In a modular monolith, it can communicate across bounded contexts: a reservation module publishes an event, and a reporting module consumes it to update a query projection. section 13.6

Listing 13.4 An expanded team persona for AI-assisted pairing
public record ReservationPlaced(
    ReservationId id,
    FulfilmentCentreId centreId,
    ProductId productId,
    Quantity reserved,
    Instant occurredAt
) implements DomainEvent {
 
    public ReservationPlaced {
        Objects.requireNonNull(id, "ReservationId must not be null");
        Objects.requireNonNull(centreId, "FulfilmentCentreId must not be null");
        if (reserved.isNegative()) {
            throw new IllegalArgumentException("Reserved quantity must not be negative");
        }
    }
}

ReservationPlaced illustrates an event record with identifiers, reserved quantity, and occurrence time, plus basic validation. section 13.6

How Build High Value Software Systems covers it

How deep it goes
Defines an event through a Java record and traces its use in a projection, without detailing the full implementation.
Examples
Models ReservationPlaced with reservation details and uses it to support cross-center inventory visibility.
What you can do after
Understand how to model a reservation event and use it to update a reporting projection.
How it connects
Connects domain events to bounded contexts, modular monoliths, and materialized views.

Also explained in

Compare how 4 books explain domain event →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build High Value Software Systems. The section links point to the parts of the book it draws on.