uber / cadence-java-client

Java framework for Cadence Workflow Service
https://cadenceworkflow.io
Other
142 stars 106 forks source link

Activity heartbeat should not require Activity thread to run #414

Open meiliang86 opened 4 years ago

meiliang86 commented 4 years ago

Currently Activity heartbeat can only be called from Activity thread. This is quite inconvenient if people want to spawn timers and offload the heartbeat logic to the timer thread, etc.

Since heartbeat is asynchronous anyways, it does make sense to relax this requirement. So that heartbeat can be called from any thread. The caveat is that caller needs to specify other information like domainID, workflowID and activityID etc as we will not be able to get it from the thread context.

mfateev commented 4 years ago

It is already supported: https://github.com/mfateev/uber-java-cadence-samples/blob/master/src/main/java/com/uber/cadence/samples/hello/HelloAsyncActivityCompletion.java