Examples: - Routing - Authorization - Debugging - Sampling - Throttling (sometimes) Metadata are NOT supposed to carry data needed for core or supportive domains - those belong in message data. If you need to send a message to a generic domain (send an email to a user), put the data in the event, and not rely on metadata
- Customer calls sales - Sally (from sales picks up) and takes the order - Sally calls fulfillment - Farid (from fulfillment) picks up - Sally tells Farid to ship X items to Y location using Z service
Thinking back on the previous, real-life example, should the order form include information about what number to call to fulfill the order? Should it include Farid's name? The fulfillment department (isn't it implicit)?
Something goes wrong: - Who placed the order? - Who received the request to ship? - When? etc. At the same time: - Manual inspection is impossible - Software doesn't have enough "smarts" to discover and fix - Too many things happen - Too much implicit info
Complex systems are complex. Cause-and-effect is lost. Metadata can help us understand what really happens in our systems
Sample uses of metadata: 1. Understand what your system does \ did in response to a request 1. Debug an exception 1. Advanced concurrency 1. Discovering domain - How often a user does something - Find functionality that is used in quick succession by same user - Discover common causes for a particular event Understanding what happens: 1. Filter based on message name 1. Take random sample 1. Get all events that have the same correlation id as sample Debug exceptions 1. Get all error events of specified error type (filtering on resource) 1. Take random sample 1. Get all events that have the same correlation id as sample 1. Use event id and causation id to create causal chain 1. Use resource name and version and incoming message to replay what happened in prod All of these can be fully automated and can result in being able to run locally with right versions, remote data, debugger attached... Advanced concurrency: 1. Expected version (instead of hash-etag) 1. Check newer events and confirm they're compatible