Class WorkflowCancellationService
java.lang.Object
io.axoniq.framework.workflow.runtime.execution.WorkflowCancellationService
- All Implemented Interfaces:
DescribableComponent
@Internal
public final class WorkflowCancellationService
extends Object
implements DescribableComponent
Internal entry point for requesting cancellation of running workflows by identifier.
The service associates each live workflow id with its per-execution WorkflowCancellation coordinator. It does
not implement cancellation policy itself; it locates the coordinator that schedules cancellation safely on the
workflow control thread. A future user-facing workflow manager can delegate to this service without exposing the
execution implementation.
- Since:
- 5.4.0
- Author:
- Simon Zambrovski, Stefan Dragisic
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describes the workflow identifiers for which cancellation can currently be requested.requestCancellationOfAllSteps(String workflowId, @Nullable Throwable cause) Requests cooperative cancellation of every currently-running step without terminating the workflow.requestStepCancellation(String workflowId, String stepName, @Nullable Throwable cause) Requests cooperative cancellation of one workflow step.requestWorkflowCancellation(String workflowId, @Nullable Throwable cause) Requests cancellation of a workflow.
-
Constructor Details
-
WorkflowCancellationService
public WorkflowCancellationService()
-
-
Method Details
-
requestStepCancellation
public CompletableFuture<Boolean> requestStepCancellation(String workflowId, String stepName, @Nullable Throwable cause) Requests cooperative cancellation of one workflow step.- Parameters:
workflowId- identifier of the workflow containing the stepstepName- 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
public CompletableFuture<Integer> requestCancellationOfAllSteps(String workflowId, @Nullable Throwable cause) Requests cooperative cancellation of every currently-running step without terminating the workflow.- Parameters:
workflowId- identifier of the workflow whose steps to cancelcause- optional reason for the cancellation- Returns:
- a future completing with the number of steps for which terminal cancellation was recorded
-
requestWorkflowCancellation
public CompletableFuture<Void> requestWorkflowCancellation(String workflowId, @Nullable Throwable cause) Requests cancellation of a workflow.- Parameters:
workflowId- identifier of the workflow to cancelcause- optional reason for the cancellation- Returns:
- a future completing after the workflow cancellation event is durable and the workflow body was woken
-
describeTo
Describes the workflow identifiers for which cancellation can currently be requested.- Specified by:
describeToin interfaceDescribableComponent- Parameters:
descriptor- descriptor receiving the component properties
-