Multiple participants collaborate in a distributed system.
How one know that another participant is working properly and is ready to receive messages?
- A central participant Could ping each system periodically in with a Asynchronous Request-Response conversation. If a valid response is returned, the component is "alive". This request would not be a "regular" request, but an out-of-band request that retrieves the component's status.
- The disadvantage of this solution is that monitoring depends on a single component making requests, which in itself can become a point of failure. The system also sends up sending a lot of unnecessary request messages.
- Polling the components also assumes a central monitoring entity is aware of all components' identities. In a loosely coupled system, where components come and go, this may not be a valid assumption. Components would have to register so they can be pinged.
The component supplies a Heartbeat, a series of periodic messages that indicate the component is operating well.
The Heartbeat conversation involves the following participants:
- The Component sends periodic Heartbeat messages.
- The Observer detects when the heartbeat is missing and triggers an alert or corrective action.
Related patterns: Asynchronous Request-Response