Usecase : Parent workflow invokes 1 async activity A1 and a child workflow C1. Signal method is triggered from A1 on parent taskflow, and I need to cancel the child workflow from that signal method based on some condition. I am not getting a handle of the C1 to call cancel method. Need help or suggestions on the same.
You can invoke the child workflow inside a workflow CancellationScope, for example:
CancellationScope scope =
Workflow.newCancellationScope(
() -> Async.procedure(child::doSomething, "SomeInput"));
scope.run();
When you receive a signal you can cancel this scope:
scope.cancel();
which should trigger child workflow cancellation.
Thanks for the solution, it worked perfectly fine for me.
1 Like