Interface WorkflowCancellation
- All Known Subinterfaces:
WorkflowCancellation.Request
Coordinates cancellation requests for one running workflow instance.
Cancellation is requested from arbitrary threads but executed by the workflow control thread. This preserves the
single-consumer ordering of workflow tasks and ensures that a completed future is followed by the appropriate durable
terminal event before the returned future completes. This differs from
WorkflowLifecycleControl, whose operations apply
lifecycle commands synchronously on the workflow control thread.
- Since:
- 5.4.0
- Author:
- Simon Zambrovski, Stefan Dragisic
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordRepresents one pending workflow-cancellation request owned by the cancellation coordinator.static interfaceProvides pending workflow-cancellation requests to the workflow driver. -
Method Summary
Modifier and TypeMethodDescriptionrequestCancellationOfAllSteps(@Nullable Throwable cause) Requests cooperative cancellation of every currently-running workflow step without terminating the workflow.requestStepCancellation(String stepName, @Nullable Throwable cause) Requests cooperative cancellation of one running workflow step.requestWorkflowCancellation(@Nullable Throwable cause) Requests cancellation of the workflow and its local execution.
-
Method Details
-
requestStepCancellation
Requests cooperative cancellation of one running workflow step.- Parameters:
stepName- name of the step to cancelcause- optional reason for the cancellation- Returns:
- a future completing with
truewhen a terminal step cancellation was recorded, orfalsewhen the step was unknown or already terminal
-
requestCancellationOfAllSteps
Requests cooperative cancellation of every currently-running workflow step without terminating the workflow.- Parameters:
cause- optional reason for the cancellation- Returns:
- a future completing with the number of steps for which terminal cancellation was recorded
-
requestWorkflowCancellation
Requests cancellation of the workflow and its local execution.- Parameters:
cause- optional reason for the cancellation- Returns:
- a future completing after the workflow cancellation event is durable and the workflow body was woken
-