Skip to content

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

@mintybayleaf

Description

@mintybayleaf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions