Domain events are a way to decouple systems for better maintainability and reuse. But what information should be included in an event?
There is no general answer as it depends on the use-case of the subscriber. However there are three classifications:
This means that all data a subscriber could need, is included in the event. Subscribers don’t need to call any APIs and are at runtime less coupled to the publishers domain.
Only IDs are included in the event. Subscribers have to use an API of other domains to get the relevant updated information to update the local state.
Like a thin event but includes Information about the changes, so a subscriber can use that in most cases to update their local state.
It depends on the use-case which way is the best. Always fetching all information via other domains APIs has the advantage of being always up to date. Relying on the events content can be needed when the sequence of changes is important