Open fenix2304 opened 4 years ago
I don't fully understand the problem yet, are you trying to cancel workflow by custom cause? how did you set the cause in workflow/client? Is that set when workflow start or during the run?
Cadence cancel/terminate requires workflow workflowID/RunID. One way to cancel by customer cause is using search attributes. Add a cause search attributes to workflow, so that later you can find workflow ids with specific cause and do a batch cancel.
(If you don't use search attributes, try to see if you can add that cause to workflow ID so that you can get the workflow you want to; If the load is not big, you can also try query each workflow for that cause state then act depend on query result)
Take a step back, what is the reason you need to cancel the workflow by cause? If it is because the workflow running into a specific state, maybe worth to consider redesign the workflow, one common idea is having manager workflow to start child workflow, and if child workflow runs into bad state, signal to parent, so that later parent can know all child in specific state and act accordingly.
Hi @vancexu, thank for answer,
We are trying to cancel workflow, using cadence-client 2.6.3 (https://www.javadoc.io/doc/com.uber.cadence/cadence-client/2.6.3/com/uber/cadence/RequestCancelWorkflowExecutionRequest.html); we are trying that, because we need use cancellation information later, by java-client or elasticsearch. Maybe is a better idea use a search attributes for that, but we should be able to cancel it, and add that info, when it are running
Hi everyone, i would need help with a problem, in my team we try to cancel a WF, using RequestCancelWorkflowExecutionRequest of cadence-client, but we must add info about the cancellation, to later use that by cause variable of WorkflowExecutionCancelRequestedEventAttributes in history of WF, but i can't cancel the WF using cause field with the cadence-client. Could someone tell me the best way to cancel a orden with cadence-client setting cause field?