Skip to content

Data contracts, read models and integration events

What crosses a boundary: data contracts (payloads), read models (projections with mappings) and integration events (what a context publishes).

Data contracts

A data contract is a named payload with fields, each with a name, a description and a type: the request of a public API, the body of a message. It belongs to a bounded context or to the project.

Read models

A read model is a projection built for reading. Each of its fields has a type, a mapping (where the value comes from) and whether it is part of the key.

Integration events

An integration event is what a context publishes for others, such as OrderPlaced, with its fields. Other contexts react with event handlers.

When to use which

You needUse
Something another system sends or receivesA data contract
A view optimised for a screen or a reportA read model
A fact another context must learn aboutAn integration event

Next steps