Event Notification
Notify other systems that something has happened by publishing a lightweight event.
Intent & Description
⚠️ Problem
How can a service notify other services about changes without tight coupling?
📋 Context
A service needs to inform other services that something noteworthy has happened, such as a state change. The publishing service does not need to know what, if anything, the consumers will do with the notification.
💡 Solution
When a noteworthy event occurs, the service publishes a lightweight event notification that contains minimal data—typically just the event type and an identifier. Interested consumers subscribe to these events and, if they need more details, call back to the source service’s API to retrieve the full data. This approach minimizes the coupling between services since the event carries minimal information and the producer does not need to know the consumers.
Real-world Use Case
Source
Advantages
- Minimal coupling between event producer and consumers
- Small event payload reduces bandwidth and storage
- Producer does not need to know what consumers need
- Simple event schema that is easy to evolve
Disadvantages
- Consumers must make additional API calls to retrieve full data, increasing latency
- Source service must handle callback load from multiple consumers
- Temporal coupling if consumers need data at the time of the event that may change later
- Harder to replay or reconstruct state from events alone