Interface WorkflowManager
- All Known Implementing Classes:
SimpleWorkflowManager
public interface WorkflowManager
Provides the outside-in API for locating workflow instances and requesting cancellation from application or
administrative code. Use
findOne(WorkflowStateQuery) when the query must select at most one instance, or
findMany(WorkflowStateQuery) to operate on every matching instance.
Cancellation requests are asynchronous and affect live workflow executions only. For example, to request cancellation of a workflow identified by its workflow ID:
workflowManager.findOne(WorkflowStateQuery.byWorkflowId(workflowId))
.requestWorkflowCancellation(null);
The returned future completes after the cancellation event is durable and the workflow body has been woken. Use the
workflow execution context to initiate cancellation from inside a workflow definition.- Since:
- 5.4.0
- Author:
- Simon Zambrovski
-
Method Summary
Modifier and TypeMethodDescriptionfindMany(WorkflowStateQuery query) Finds every workflow instance matching a query.findOne(WorkflowStateQuery query) Finds the single workflow instance matching a query.
-
Method Details
-
findOne
Finds the single workflow instance matching a query.The returned result evaluates the query when
WorkflowInstances.Single.singleState()is invoked. That operation completes withnullwhen no instance matches. When more than one instance matches, callingCompletableFuture.join()throws aCompletionExceptionwhose cause is aNonUniqueWorkflowInstanceMatchException.Use a workflow ID when it uniquely identifies the instance to resolve:
workflowManager.findOne(WorkflowStateQuery.byWorkflowId(workflowId)) .singleState() .thenAccept(state -> { if (state != null) { inspect(state); } });- Parameters:
query- criteria used to select the workflow instance- Returns:
- lazy result for the single matching workflow instance
-
findMany
Finds every workflow instance matching a query.- Parameters:
query- criteria used to select workflow instances- Returns:
- lazy handle for the matching workflow instances
-