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 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 step
      stepName - name of the step to cancel
      cause - optional reason for the cancellation
      Returns:
      a future completing with true when a terminal step cancellation was recorded, or false when 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 cancel
      cause - 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 cancel
      cause - optional reason for the cancellation
      Returns:
      a future completing after the workflow cancellation event is durable and the workflow body was woken
    • describeTo

      public void describeTo(ComponentDescriptor descriptor)
      Describes the workflow identifiers for which cancellation can currently be requested.
      Specified by:
      describeTo in interface DescribableComponent
      Parameters:
      descriptor - descriptor receiving the component properties