Workflow status: Canceled vs. Canceling?

Greetings. You can check workflow status using DescribeWorkflowExecutionResponse#getWorkflowExecutionInfo#getStatus(). However, the CANCELED state is special case. For a given workflow instance, how can you discriminate between: (i) cancel issued, (ii) cancel pending (i.e. in cancelation-scopes) and (iii) cancelled (i.e. cancel finished + workflow closed)? I realize I can check the workflow-history for the cancellation-event, but wondered if there was another way. Many thanks!

1 Like

You are correct, there is no way to find out if cancellation was requested looking at the DescribeWorkflowExecutionResponse.

I’m not sure about your (ii) state of cancel pending as CancellationScopes can be explicitly created by the workflow code and the service doesn’t even know about them.