Here we explain what heartbeats are and how to configure DataSource applications to exchange heartbeat messages.
Two DataSource applications can exchange heartbeat messages, which enables them to detect the loss of the connection between them, even in situations where the operating system can't or doesn't inform the application that the connection is lost.
A DataSource application won't send heartbeats if it's already sending data, with the exception of Java-based applications (implemented using the Caplin Integration Suite), which always send heartbeats if they're enabled.
When heartbeats are enabled, the receiving DataSource application applies the heartbeat-time and heartbeat-slack-time configuration settings to the receipt of all data. So if the application doesn't receive either some data or a heartbeat within the time
heartbeat-time + heartbeat-slack-time, it assumes the connection to the sending peer is down.
Heartbeats aren't enabled by default. To enable them, in the configuration for at least one of the DataSource applications, define the heartbeat-time option in the add-peer item that refers to the other application:
# # Peers configuration # # add-peer remote-name fxpriceadapter1 # # Enable heartbeat messages every 5 seconds # between this DataSource application # and the fxpriceadapter1 peer. # heartbeat-time 5 ... end-peer
Once the two DataSource applications have initially connected, they compare their
heartbeat-time values and use the lowest.
You might additionally want to explicitly configure the related heartbeat-slack-time option, though it does have a default setting of 2.0 seconds which should be adequate for most purposes.
- How can I... Use timers in DataSource applications