sdk-java icon indicating copy to clipboard operation
sdk-java copied to clipboard

Add the ability to keep heartbeating while the worker is shutting down

Open mintybayleaf opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

The WorkerFactory.shutdown call starts killing the heartbeats like it says in the documentation with the ActivityWorkerShutdownException but what is the point of waiting N units of time with WorkerFactory.awaitTermination if right when the worker shutdown is called the heartbeats die and then the activities die off because the heartbeats are no longer going....

Describe the solution you'd like

I want the ability to keep heartbeating while the worker is shutting down so my activities can actually finish my activities work with WorkerFactory.awaitTermination when my activities have heartbeats.

For example: If I tell the awaitTermination call to wait 25 minutes my heartbeat calls should still be valid for 25 minutes and then the heartbeat call can start reporting the ActivityWorkerShutdownException

Describe alternatives you've considered

Call ActivityExecutionContext.useLocalManualCompletion() and then use the ManualActivityCompletionClient to heartbeat.

Additional context

See the Temporal Java SDK slack thread here: https://temporalio.slack.com/archives/CTT84KXK9/p1716488319315099

mintybayleaf avatar May 23 '24 18:05 mintybayleaf

Do we have a timeline for the fix?

madhav2302 avatar Jul 18 '24 15:07 madhav2302