tuk
1
Let’s say I have a worklow which is sleeping using Workflow.sleep()
. How the workflow can be cancelled or I have to do one of the below
- Use
terminate
instead of cancel
or
Workflow.await()
along with @SignalMethod should be used to finish the workflow
I am using Java SDK.
maxim
2
There are many ways. The simplest one IMHO:
Workflow.newTimer().cancellableGet()
If you want to handle cancellation explicitly, you can always get a Promise that becomes ready when a scope is canceled.
Promise<String> cancellationPromise = CancellationScope.current().getCancellationRequest();
If you want to handle the notification asynchronously, use Promise.thenAppy
or Promise.handle
.