I have a software application where we have 2 services, say
A delegates some long running work(tracked by an
B which is done asynchronously.
They both talk via HTTP.
Post submitting the job,
A periodically does
getStatus calls passing the
Given that any of
B can die, I need to handle failure scenarios.
I was thinking of using above
getStatus calls as
2 way heartbeats which would behave as following for unhappy cases(and their handling after
1. A unable to reach B -> heartbeat would timeout/connection refused, leading A to think work has failed 2. A is able to reach B but B has crashed and restarted -> heartbeat is treated as unknown, leading A to think work has failed 3. A dies/becomes unresponsive -> B misses few heartbeats and cancels its work(via timer), another A would reschedule this
heartbeat handling looks like a good approach for
A as well as
B to know about each other's liveness?