I created a simple workflow that creates and calls an activity that runs a while(true) loop which writes logs like so:
public void testLoop() {
do {
try {
LOGGER.info("Still running activity");
Thread.sleep(3000);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted while sleeping between requests.", e);
}
} while (true);
}
When I terminate the workflow in the Temporal UI, it seems the activity is still running and logging. Shouldn’t the activity be terminated (similar to how child workflows are terminated when their parents are)? Or am I missing something when I created the activity stub?
Edit: Forgot to mention, scheduled timeouts are also not being respected. I set the .setStartToCloseTimeout for 5 minutes for the activity and it was still logging after the timeout period.
PS. I think the javadoc needs to be updated for ActivityCancellationType since it refers to workflows still (copied from ChildWorkflow cancellation I assume)
Currently, the only way an activity can learn about its cancellation or workflow completion is through the heartbeat. As your activity is not heartbeating it will run until its method returns.