Create four childWorkflow B, C, and D in parentWorkflow A. When childWorkflow B failed , C and D continue to execute a defined exit function before failed.How to do it?
Can you share some sample code? I assume you are looking for cancellation scope, see sample here if that helps.
I have a parent workflow A. Under A, an activity runs tasks D, C, and D asynchronously. Task B fails. The exception thrown by task B is captured by workflow A. However, task C and task D need to execute some methods after workflow A captures the exception thrown by task B. However, the following exception occurs during task execution.
io.grpc.StatusRuntimeException: NOT_FOUND: workflow execution already completed
How to write the code?
Make sure that workflow doesn’t complete when the exception is thrown.
How to do it.
scope.cancel();
for(Promise<Void> result:results) {
try {
activityResult.get();
} catch (Exception e1) {
System.out.println("wait for cancel");
}
}
thid is my code.
If you want to wait for cancellation, then set ActivityOptions.cancellationType
to WAIT_CANCELLATION_COMPLETED
.
i have set it.
i get this message=‘activity Heartbeat timeout’, timeoutType=TIMEOUT_TYPE_HEARTBEAT.