Class WorkflowExecutionOperationsDelegation
java.lang.Object
io.axoniq.framework.workflow.runtime.execution.WorkflowExecutionOperationsDelegation
- All Implemented Interfaces:
AllMatchCombinator,AnyMatchCombinator,ExecutePrimitive,NoneMatchCombinator,PayloadPrimitive,PublishPrimitive,VersionPrimitive,WaitForPrimitive,WorkflowEventPublicationContext,WorkflowExecutionOperations,WorkflowLifecycleControl,DescribableComponent
public class WorkflowExecutionOperationsDelegation
extends Object
implements WorkflowExecutionOperations
Implementation of
WorkflowExecutionOperations that delegates all operations to the underlying
WorkflowExecution and primitive implementations.- Since:
- 5.4.0
- Author:
- Simon Zambrovski
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.axoniq.framework.workflow.runtime.api.execution.context.ExecutePrimitive
ExecutePrimitive.ExecuteCommandNested classes/interfaces inherited from interface io.axoniq.framework.workflow.runtime.api.execution.context.PayloadPrimitive
PayloadPrimitive.ModifyPayloadCommandNested classes/interfaces inherited from interface io.axoniq.framework.workflow.runtime.api.execution.context.PublishPrimitive
PublishPrimitive.PublishCommandNested classes/interfaces inherited from interface io.axoniq.framework.workflow.runtime.api.execution.context.VersionPrimitive
VersionPrimitive.VersionCommandNested classes/interfaces inherited from interface io.axoniq.framework.workflow.runtime.api.execution.context.WaitForPrimitive
WaitForPrimitive.WaitForCommandNested classes/interfaces inherited from interface io.axoniq.framework.workflow.runtime.api.execution.context.WorkflowLifecycleControl
WorkflowLifecycleControl.CancelStepCommand, WorkflowLifecycleControl.CancelWorkflowCommand, WorkflowLifecycleControl.FailWorkflowCommand -
Constructor Summary
ConstructorsConstructorDescriptionWorkflowExecutionOperationsDelegation(WorkflowConfiguration<?> workflowConfiguration, WorkflowContext workflowContext, WorkflowExecution workflowExecution, RunningSteps runningSteps, io.axoniq.framework.workflow.runtime.execution.EventWaitConditions eventWaitConditions, ReachedSteps reachedSteps, io.axoniq.framework.workflow.runtime.execution.WorkflowTerminalTransition terminalTransition, ProcessingContext processingContext) Creates the context delegation. -
Method Summary
Modifier and TypeMethodDescriptionallMatch(Predicate<WorkflowStepResult> predicate, WorkflowStepResult... results) Combines step results when all results satisfy the predicate.anyMatch(Predicate<WorkflowStepResult> predicate, WorkflowStepResult... results) Combines step results when any result satisfies the predicate.booleanRequests cancellation of a workflow step.voidRequests cancellation of the workflow.clock()Returns the clock used by workflow primitives.voiddescribeTo(ComponentDescriptor descriptor) Describes this workflow context to the supplied component descriptor.voideventReceived(io.axoniq.framework.workflow.runtime.execution.EventWaitConditions.Awaited awaited) Dispatches an event to the wait-for primitive.execute(ExecutePrimitive.ExecuteCommand command) Executes the step described by the given command.Returns the executor that runs workflow work.voidFails the workflow with the cause supplied by the command.Changes the workflow payload according to the given command.noneMatch(Predicate<WorkflowStepResult> predicate, WorkflowStepResult... results) Combines step results when no result satisfies the predicate.Returns the processing context of this workflow invocation.publish(PublishPrimitive.PublishCommand command) Publishes a business event as a durable workflow step according to the given command.<T extends WorkflowContext>
TRetrieves the typed author-facing workflow context.Returns the transactional unit of work factory for short-lived workflow operations.version(VersionPrimitive.VersionCommand command) Resolves the workflow version according to the given command.Waits for an event according to the given command.Factory for the unit of work wrapping a workflow instance's body execution.Returns the identifier of the workflow instance.Returns the current workflow payload.Returns the current status of the workflow.Returns the names of all known workflow steps.Returns the version of the workflow definition being executed.
-
Constructor Details
-
WorkflowExecutionOperationsDelegation
public WorkflowExecutionOperationsDelegation(WorkflowConfiguration<?> workflowConfiguration, WorkflowContext workflowContext, WorkflowExecution workflowExecution, RunningSteps runningSteps, io.axoniq.framework.workflow.runtime.execution.EventWaitConditions eventWaitConditions, ReachedSteps reachedSteps, io.axoniq.framework.workflow.runtime.execution.WorkflowTerminalTransition terminalTransition, ProcessingContext processingContext) Creates the context delegation.- Parameters:
workflowConfiguration- workflow configurationworkflowContext- author-facing context created by the factoryworkflowExecution- workflow executionrunningSteps- running step registryeventWaitConditions- event wait condition registryreachedSteps- reached steps trackerterminalTransition- owner of workflow terminal-transition execution mechanicsprocessingContext- processing context
-
-
Method Details
-
workflowId
Returns the identifier of the workflow instance.- Specified by:
workflowIdin interfaceWorkflowEventPublicationContext- Returns:
- the workflow instance identifier
-
workflowVersion
Returns the version of the workflow definition being executed.- Specified by:
workflowVersionin interfaceWorkflowEventPublicationContext- Returns:
- the workflow definition version
-
workflowPayload
Returns the current workflow payload.- Specified by:
workflowPayloadin interfaceWorkflowEventPublicationContext- Returns:
- the workflow payload
-
modifyPayload
Changes the workflow payload according to the given command.- Specified by:
modifyPayloadin interfacePayloadPrimitive- Parameters:
command- the payload modification to perform- Returns:
- the result representing the modification
-
workflowStatus
Returns the current status of the workflow.- Specified by:
workflowStatusin interfaceWorkflowExecutionOperations- Returns:
- the workflow status
-
workflowStepNames
Returns the names of all known workflow steps.- Specified by:
workflowStepNamesin interfaceWorkflowExecutionOperations- Returns:
- the workflow step names
-
processingContext
Returns the processing context of this workflow invocation.- Specified by:
processingContextin interfaceWorkflowEventPublicationContext- Returns:
- the processing context
-
execute
Executes the step described by the given command.- Specified by:
executein interfaceExecutePrimitive- Parameters:
command- the step execution command- Returns:
- the result representing the step execution
-
waitForEvent
Waits for an event according to the given command.- Specified by:
waitForEventin interfaceWaitForPrimitive- Parameters:
command- the event wait command- Returns:
- the result representing the event wait
-
version
Resolves the workflow version according to the given command.- Specified by:
versionin interfaceVersionPrimitive- Parameters:
command- the version resolution command- Returns:
- the result representing the version resolution
-
publish
Publishes a business event as a durable workflow step according to the given command.- Specified by:
publishin interfacePublishPrimitive- Parameters:
command- the publish command- Returns:
- the result representing the published step
-
cancelWorkflow
Requests cancellation of the workflow.- Specified by:
cancelWorkflowin interfaceWorkflowLifecycleControl- Parameters:
command- the workflow cancellation command
-
failWorkflow
Fails the workflow with the cause supplied by the command.- Specified by:
failWorkflowin interfaceWorkflowLifecycleControl- Parameters:
command- the workflow failure command
-
cancelStep
Requests cancellation of a workflow step.- Specified by:
cancelStepin interfaceWorkflowLifecycleControl- Parameters:
command- the step cancellation command- Returns:
truewhen the cancellation was accepted
-
allMatch
public CombinatorWorkflowStepResult allMatch(Predicate<WorkflowStepResult> predicate, WorkflowStepResult... results) Combines step results when all results satisfy the predicate.- Specified by:
allMatchin interfaceAllMatchCombinator- Parameters:
predicate- predicate each result must satisfyresults- results to combine- Returns:
- the combined step result
-
anyMatch
public CombinatorWorkflowStepResult anyMatch(Predicate<WorkflowStepResult> predicate, WorkflowStepResult... results) Combines step results when any result satisfies the predicate.- Specified by:
anyMatchin interfaceAnyMatchCombinator- Parameters:
predicate- predicate at least one result must satisfyresults- results to combine- Returns:
- the combined step result
-
noneMatch
public CombinatorWorkflowStepResult noneMatch(Predicate<WorkflowStepResult> predicate, WorkflowStepResult... results) Combines step results when no result satisfies the predicate.- Specified by:
noneMatchin interfaceNoneMatchCombinator- Parameters:
predicate- predicate no result may satisfyresults- results to combine- Returns:
- the combined step result
-
clock
Returns the clock used by workflow primitives.- Returns:
- the workflow clock
-
unitOfWorkFactory
Returns the transactional unit of work factory for short-lived workflow operations.- Returns:
- the transactional unit of work factory
-
workflowBodyUnitOfWorkFactory
Factory for the unit of work wrapping a workflow instance's body execution.The body-wrapper unit of work stays open for the workflow instance's entire lifetime, including any time the body spends parked at
awaitEvent,sleep, or retry backoff. It is therefore non-transactional, as a transaction bound to it would hold its resources per in-flight instance for as long as the instance lives. Workflow and step events are published in short-lived child units of work created from the transactionalunitOfWorkFactory()instead.- Returns:
- the non-transactional unit of work factory used for the workflow-body wrapper
-
executorService
Returns the executor that runs workflow work.- Returns:
- the workflow executor
-
eventReceived
@Internal public void eventReceived(io.axoniq.framework.workflow.runtime.execution.EventWaitConditions.Awaited awaited) Dispatches an event to the wait-for primitive.- Parameters:
awaited- event arrival wrapper object
-
typedWorkflowContext
Retrieves the typed author-facing workflow context.- Type Parameters:
T- workflow context type- Returns:
- typed workflow context created by the factory
-
describeTo
Describes this workflow context to the supplied component descriptor.- Specified by:
describeToin interfaceDescribableComponent- Parameters:
descriptor- descriptor to populate
-