Class InMemoryWorkflowExecutionRepository
- All Implemented Interfaces:
WorkflowExecutionRepository,DescribableComponent
WorkflowExecutionRepository backed by a ConcurrentHashMap.- Since:
- 5.4.0
- Author:
- Stefan Dragisic
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all stored workflow executions.voiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.findAll(WorkflowStateQuery query) Returns all stored workflow executions whose state matches a query.findAll(Predicate<WorkflowExecution> predicate) Returns all stored workflow executions matching the given predicate, with at most one execution per workflow identifier.Finds a workflow execution by its identifier.Removes the workflow execution associated with the given identifier.voidremoveAll(Predicate<WorkflowExecution> predicate) Removes all workflow executions matching the given predicate.save(String workflowId, Supplier<WorkflowExecution> factory) Atomically stores a new workflow execution if no execution exists for the given workflow identifier.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.axoniq.framework.workflow.runtime.execution.WorkflowExecutionRepository
findAll
-
Constructor Details
-
InMemoryWorkflowExecutionRepository
public InMemoryWorkflowExecutionRepository()Creates a new instance of .
-
-
Method Details
-
findById
Description copied from interface:WorkflowExecutionRepositoryFinds a workflow execution by its identifier.- Specified by:
findByIdin interfaceWorkflowExecutionRepository- Parameters:
workflowId- the workflow identifier- Returns:
- an
Optionalcontaining the workflow execution, or empty if not found
-
findAll
Description copied from interface:WorkflowExecutionRepositoryReturns all stored workflow executions matching the given predicate, with at most one execution per workflow identifier.- Specified by:
findAllin interfaceWorkflowExecutionRepository- Parameters:
predicate- the predicate to match workflow executions against- Returns:
- an unmodifiable collection of all workflow executions
-
findAll
Description copied from interface:WorkflowExecutionRepositoryReturns all stored workflow executions whose state matches a query.- Specified by:
findAllin interfaceWorkflowExecutionRepository- Parameters:
query- state criteria to apply- Returns:
- a future completing with an unmodifiable collection of matching workflow executions
-
save
Description copied from interface:WorkflowExecutionRepositoryAtomically 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.- Specified by:
savein interfaceWorkflowExecutionRepository- Parameters:
factory- the factory to create a new workflow execution if absent- Returns:
- the existing or newly created workflow execution
-
remove
Description copied from interface:WorkflowExecutionRepositoryRemoves the workflow execution associated with the given identifier.- Specified by:
removein interfaceWorkflowExecutionRepository- Parameters:
workflowId- the identifier of the workflow to remove- Returns:
- the removed
WorkflowExecution, ornullif no execution was found
-
removeAll
Description copied from interface:WorkflowExecutionRepositoryRemoves all workflow executions matching the given predicate.- Specified by:
removeAllin interfaceWorkflowExecutionRepository- Parameters:
predicate- the predicate to match workflow executions against
-
clear
public void clear()Description copied from interface:WorkflowExecutionRepositoryRemoves all stored workflow executions.- Specified by:
clearin interfaceWorkflowExecutionRepository
-
describeTo
Description copied from interface:DescribableComponentDescribe the properties ofthis DescribableComponentwith the givendescriptor.Components should call the appropriate
describePropertymethods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.Best Practices: As a general rule, all relevant fields of a
DescribableComponentimplementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing thedescribeTomethod, who should focus on providing information that is useful for understanding the component's configuration and state.Example implementation:
public void describeTo(ComponentDescriptor descriptor) { descriptor.describeProperty("name", this.name); descriptor.describeProperty("enabled", this.enabled); descriptor.describeProperty("configuration", this.configuration); // A nested component descriptor.describeProperty("handlers", this.eventHandlers); // A collection }- Specified by:
describeToin interfaceDescribableComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-