Interface WorkflowExecutionRepository

All Superinterfaces:
DescribableComponent
All Known Implementing Classes:
InMemoryWorkflowExecutionRepository

public interface WorkflowExecutionRepository extends DescribableComponent
Repository for retrieving workflow executions, storing new ones, and removing them.

Each workflow execution is identified by a unique workflow identifier and is represented as a WorkflowExecution bundling configuration, context, and execution state.

Since:
5.4.0
Author:
Stefan Dragisic
  • Method Details

    • findById

      Optional<WorkflowExecution> findById(String workflowId)
      Finds a workflow execution by its identifier.
      Parameters:
      workflowId - the workflow identifier
      Returns:
      an Optional containing the workflow execution, or empty if not found
    • findAll

      default Set<WorkflowExecution> findAll()
      Returns all stored workflow executions, with at most one execution per workflow identifier.
      Returns:
      an unmodifiable collection of all workflow executions
    • findAll

      Returns all stored workflow executions whose state matches a query.
      Parameters:
      query - state criteria to apply
      Returns:
      a future completing with an unmodifiable collection of matching workflow executions
    • findAll

      Returns all stored workflow executions matching the given predicate, with at most one execution per workflow identifier.
      Parameters:
      predicate - the predicate to match workflow executions against
      Returns:
      an unmodifiable collection of all workflow executions
    • save

      WorkflowExecution save(String workflowId, Supplier<WorkflowExecution> factory)
      Atomically stores a new workflow execution if no execution exists for the given workflow identifier. If an execution already exists, returns the existing one without invoking the factory.
      Parameters:
      factory - the factory to create a new workflow execution if absent
      Returns:
      the existing or newly created workflow execution
    • remove

      WorkflowExecution remove(String workflowId)
      Removes the workflow execution associated with the given identifier.
      Parameters:
      workflowId - the identifier of the workflow to remove
      Returns:
      the removed WorkflowExecution, or null if no execution was found
    • removeAll

      void removeAll(Predicate<WorkflowExecution> predicate)
      Removes all workflow executions matching the given predicate.
      Parameters:
      predicate - the predicate to match workflow executions against
    • clear

      void clear()
      Removes all stored workflow executions.