Temporal new user here and Loving the fine grained controls I have !!! (compared to the other state machine based workflow engines I have used before)
I am designing a long running Batch Activity which relies on heartbeat mechanism to keep checkpoints , so the activityimpl is already doing heartbeat after every record processing.
I have a requirement to pause the Batch Processing and resume it in a later phase. I was wondering if there is any mechanism for a workflow to send additional info to the heartbeat data. I understand we dont want heartbeat part of workflow history records. But some sort of interceptor like this:
Then within my activity i can do isPaused(Workflow.getHeartBeat()) before starting the next batch processing.
-------option:2
If the mechanism above is not available, is there any downside of Looking up the parent Workflow from the activity and do a query method to check if its paused?
– option:3
The alternative i can think of is to cancel the activity execution from parent , in that case I am trying to understand how the heartbeat info will be preserved.
I think querying the workflow from the activity periodically is the simplest solution.
The problem with the cancellation that you are going to lose the progress in the heartbeat info.
If you prefer to send a notification to an activity then you can execute another activity in the same process using a process specific task queue. The batch processing activity at the beginning should use a signal to send the process specific task queue name to the workflow.
Any plans to extend more control over the heartbeat? being able to intercept and inject info from workflow (which dont need to go to history) can be very powerful. This can work almost like a @Query method on a workflow
I don’t think extending the heartbeat is the right abstraction here. We recently added the ability to pause/unpause an activity through an API. We should ensure that the heartbeat details are not lost in this case.
In the future, we might add the ability to communicate directly with an activity. Imagine being able to send updates/signals/queries to a currently executing activity.