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
