Heartbeats, a common software construct, are used to verify the continual operation of a specific component or service. With the help of heartbeats, a targeted service continually broadcasts a signal across its environment.
A D V E R T I S E M E N T
You can assume that your system works normally when your client services can detect a targeted service's heartbeat signals. Meanwhile, if the critical heartbeat signal ceases, each component knows how to react to the critical section.
As a heartbeat example, consider a backend market-price publisher. The publisher publishes realtime prices to other services on the network, as shown in the Figure below. Because a pause in price publishing could indicate either a legitimate market pause or a system problem resulting in stale price information, it's critical that other services receive proper system status information.
To avoid the stale price information, the publisher periodically issues the heartbeat signal to the clients services, keeping them informed of its status. If the heartbeat signal ends, the system customer inquiry module might warn the customer of the stale price information, will resume shortly. Until the publisher resumes publishing current prices, meanwhile the application's risk management system would suspend other transactions.
Background of the JMS Heartbeats:
I recently used a similar setup with a series of interdependent components such that, if one failed, the others received notification. I used JMS messaging as a way to transmit heartbeats between components, because the system is employed with JMS (Java Message Service) as a core component.
However, i didn't realize the critical nature of the interdependencies, so a proprietary heartbeat, implemented differently each time, supported each relationship at the project's start. Figure below shows the result.
In many systems, developers implement heartbeats using multicast suitable for broadcasting an "I'm still here!" signal, but not necessarily for targeting a specific process or consumer, particularly in high-availability operating systems.
However, a JMS-based heartbeat system proves ideal for periodically determining whether the overall system, the network, the JMS server, the JVM, and so on remains in operation.