liveBook · Manning

Event contract

As explained in Microservices Patterns, Second Edition

An event contract specifies the data and structure that an event publisher provides to its consumers.

An event contract is an agreement between provider and consumer teams about which events are published and which properties they contain. In CQRS, it lets a view service receive the data needed to maintain its query-optimized view. section 13.3.4 section 13.2.3

When designing a provider event:

  • Include the publishing aggregate’s ID. Add related aggregate IDs when a view operation needs them to find or later relate records. section 13.3.4
  • Agree across teams on the events and properties consumers need; coordinate versioning and backward compatibility to avoid breaking downstream consumers. section 13.3.4 section 13.2.3

OrderCreated

An OrderCreated event carries the Order ID for the record to create and the Consumer ID, which lets a later query find that consumer’s orders. section 13.3.4

How Microservices Patterns, Second Edition covers it

How deep it goes
Specifies required aggregate identifiers and team coordination, without detailing a full versioning procedure.
Examples
Uses OrderCreated with Order and Consumer IDs to illustrate event payload requirements.
What you can do after
Evaluate event payloads for the identifiers and properties view operations require.
How it connects
Links CQRS, domain events, aggregates, and view repositories.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.