What to put in an event.
WHAT AN EVENT DESCRIBES
Something that happened, in the past tense.
WHY PAST TENSE
It is a statement of fact, not an instruction.
WHAT EVERY EVENT NEEDS
A unique identifier A type When it occurred The subject it concerns A version
WHY A VERSION ON THE EVENT
Formats change, and consumers must know what they received.
WHAT TO INCLUDE BEYOND THAT
Either the relevant data, or enough to fetch it.
WHAT INCLUDING DATA PROVIDES
Consumers not calling back Working even if the source is unavailable
WHAT IT COSTS
Data that may be stale by the time it is processed Sensitive data travelling further
WHAT INCLUDING ONLY AN IDENTIFIER PROVIDES
Always-current data, and minimal exposure.
WHAT IT COSTS
A dependency on the source being available.
WHAT TO CHOOSE
Data for things that do not change, identifiers for things that do.
WHAT TO AVOID
Events describing intentions rather than facts Events so large they become the data store Consumers depending on ordering
WHY ORDERING SPECIFICALLY
Most systems do not guarantee it across a topic.
WHAT TO INCLUDE IF ORDER MATTERS
A sequence number the consumer can use.