Class StateBasedWorkflowStepResult
java.lang.Object
io.axoniq.framework.workflow.runtime.execution.StateBasedWorkflowStepResult
- All Implemented Interfaces:
WorkflowStepResult
Workflow Step result based on the Workflow State.
- Since:
- 5.4.0
- Author:
- Allard Buijze, Stefan Dragisic, Simon Zambrovski
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceBlocks until the workflow state changes. -
Constructor Summary
ConstructorsConstructorDescriptionStateBasedWorkflowStepResult(String stepName, StateBasedWorkflowStepResult.StateChangeTrigger stateChangeTrigger, Consumer<Throwable> cancellation, WorkflowExecution state) Creates a result backed by the current workflow execution state. -
Method Summary
Modifier and TypeMethodDescriptionvoidawait()Blocks until step execution reaches a terminal state.voidcancel()Cancels this step if it is still running.voidCancels this step with a reason if it is still running.booleancanceled()Blocks until step execution reaches a terminal state.error()Retrieves an optional error.booleanfailure()Blocks until step execution reaches a terminal state.booleanCheck (non-blocking) if the step has finished (reached a terminal state).result()Retrieves optional result.<T> Optional<T> Retrieves an optional result as a specific type.<T> Optional<T> Retrieves an optional result as a specific type.booleansuccess()Blocks until step execution reaches a terminal state.booleantimeout()Blocks until step execution reaches a terminal state.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.dsl.api.WorkflowStepResult
resultAs, resultAs, resultAs, resultAs
-
Constructor Details
-
StateBasedWorkflowStepResult
public StateBasedWorkflowStepResult(String stepName, StateBasedWorkflowStepResult.StateChangeTrigger stateChangeTrigger, Consumer<Throwable> cancellation, WorkflowExecution state) Creates a result backed by the current workflow execution state.- Parameters:
stepName- step represented by this resultstateChangeTrigger- operation that waits for the next state changecancellation- operation that requests cancellation of this stepstate- workflow execution providing the state
-
-
Method Details
-
getStepName
- Specified by:
getStepNamein interfaceWorkflowStepResult
-
isCompleted
public boolean isCompleted()Description copied from interface:WorkflowStepResultCheck (non-blocking) if the step has finished (reached a terminal state).- Specified by:
isCompletedin interfaceWorkflowStepResult- Returns:
- true, if the state is terminal.
-
result
Description copied from interface:WorkflowStepResultRetrieves optional result.- Specified by:
resultin interfaceWorkflowStepResult- Returns:
- result if the step has finished with a success. Will return empty optional, if the step is not finished.
-
resultAs
Description copied from interface:WorkflowStepResultRetrieves an optional result as a specific type.- Specified by:
resultAsin interfaceWorkflowStepResult- Type Parameters:
T- the type of the result- Parameters:
type- the type to convert the result to- Returns:
- result if the step has finished with a success. Will return empty optional, if the step is not finished
-
resultAs
Description copied from interface:WorkflowStepResultRetrieves an optional result as a specific type.- Specified by:
resultAsin interfaceWorkflowStepResult- Parameters:
type- the type to convert the result to- Returns:
- result if the step has finished with a success. Will return empty optional, if the step is not finished
-
error
Description copied from interface:WorkflowStepResultRetrieves an optional error.- Specified by:
errorin interfaceWorkflowStepResult- Returns:
- error if the step has finished with an error. Will return empty optional, if the step is not finished
-
success
public boolean success()Description copied from interface:WorkflowStepResultBlocks until step execution reaches a terminal state.- Specified by:
successin interfaceWorkflowStepResult- Returns:
- true, if the operation completed successfully
-
failure
public boolean failure()Description copied from interface:WorkflowStepResultBlocks until step execution reaches a terminal state.- Specified by:
failurein interfaceWorkflowStepResult- Returns:
- true, if the operation completed with an exception
-
canceled
public boolean canceled()Description copied from interface:WorkflowStepResultBlocks until step execution reaches a terminal state.- Specified by:
canceledin interfaceWorkflowStepResult- Returns:
- true, if the operation was interrupted by an external party
-
timeout
public boolean timeout()Description copied from interface:WorkflowStepResultBlocks until step execution reaches a terminal state.- Specified by:
timeoutin interfaceWorkflowStepResult- Returns:
- true, if the operation was interrupted by timeout specified on start
-
await
public void await()Description copied from interface:WorkflowStepResultBlocks until step execution reaches a terminal state.- Specified by:
awaitin interfaceWorkflowStepResult
-
cancel
public void cancel()Description copied from interface:WorkflowStepResultCancels this step if it is still running. No-op if already in a terminal state.- Specified by:
cancelin interfaceWorkflowStepResult
-
cancel
Description copied from interface:WorkflowStepResultCancels this step with a reason if it is still running. No-op if already in a terminal state.- Specified by:
cancelin interfaceWorkflowStepResult- Parameters:
reason- human-readable cancellation reason.
-