Package io.iworkflow.core
Class StateDecision
java.lang.Object
io.iworkflow.core.StateDecision
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.iworkflow.core.ImmutableStateDecision.Builderbuilder()static StateDecisiondeadEnd()static StateDecisionforceCompleteIfInternalChannelEmptyOrElse(Object completionOutput, String internalChannelName, StateMovement... orElseStateMovements) Atomically force complete the workflow if internal channel is empty, otherwise trigger the state movements from the current thread This is important for use case that needs to ensure all the messages in the channel are processed before completing the workflow, otherwise messages will be lost.static <I> StateDecisionforceCompleteIfInternalChannelEmptyOrElse(Object completionOutput, String internalChannelName, Class<? extends WorkflowState<I>> orElseStateClass) static <I> StateDecisionforceCompleteIfInternalChannelEmptyOrElse(Object completionOutput, String internalChannelName, Class<? extends WorkflowState<I>> orElseStateClass, I stateInput) static <I> StateDecisionforceCompleteIfInternalChannelEmptyOrElse(String internalChannelName, Class<? extends WorkflowState<I>> orElseStateClass) static <I> StateDecisionforceCompleteIfInternalChannelEmptyOrElse(String internalChannelName, Class<? extends WorkflowState<I>> orElseStateClass, I stateInput) static StateDecisionforceCompleteIfSignalChannelEmptyOrElse(Object completionOutput, String signalChannelName, StateMovement... orElseStateMovements) Atomically force complete the workflow if signal channel is empty, otherwise trigger the state movements from the current thread This is important for use case that needs to ensure all the messages in the channel are processed before completing the workflow, otherwise messages will be lost.static <I> StateDecisionforceCompleteIfSignalChannelEmptyOrElse(Object completionOutput, String signalChannelName, Class<? extends WorkflowState<I>> orElseStateClass) static <I> StateDecisionforceCompleteIfSignalChannelEmptyOrElse(Object completionOutput, String signalChannelName, Class<? extends WorkflowState<I>> orElseStateClass, I stateInput) static <I> StateDecisionforceCompleteIfSignalChannelEmptyOrElse(String signalChannelName, Class<? extends WorkflowState<I>> orElseStateClass) static <I> StateDecisionforceCompleteIfSignalChannelEmptyOrElse(String signalChannelName, Class<? extends WorkflowState<I>> orElseStateClass, I stateInput) static StateDecisionstatic StateDecisionforceCompleteWorkflow(Object completionOutput) static StateDecisionstatic StateDecisionforceFailWorkflow(Object completionOutput) abstract List<StateMovement>abstract Optional<InternalConditionalClose>static StateDecisionstatic StateDecisiongracefulCompleteWorkflow(Object completionOutput) static StateDecisionmultiNextStates(StateMovement... stateMovements) static StateDecisionmultiNextStates(Class<? extends WorkflowState>... states) use other ones with a list of StateMovement to enable the WorkflowStateOptions overridingstatic StateDecisionmultiNextStates(String... stateIds) use the other one with WorkflowState class param if the stateId is provided by default, to make your code cleaner or use other ones with a list of StateMovement to enable the WorkflowStateOptions overridingstatic StateDecisionmultiNextStates(List<StateMovement> stateMovements) static <I> StateDecisionsingleNextState(Class<? extends WorkflowState<I>> stateClass) static <I> StateDecisionsingleNextState(Class<? extends WorkflowState<I>> stateClass, I stateInput) static <I> StateDecisionsingleNextState(Class<? extends WorkflowState<I>> stateClass, I stateInput, WorkflowStateOptions stateOptionsOverride) static <I> StateDecisionsingleNextState(Class<? extends WorkflowState<I>> stateClass, I stateInput, String waitForKey) static StateDecisionsingleNextState(String stateId) use the other one with WorkflowState class param if the stateId is provided by default, to make your code cleanerstatic StateDecisionsingleNextState(String stateId, Object stateInput, WorkflowStateOptions stateOptionsOverride) use the other one with WorkflowState class param if the stateId is provided by default, to make your code cleanerstatic StateDecisionsingleNextState(String stateId, Object stateInput, WorkflowStateOptions stateOptionsOverride, String waitForKey) use the other one with WorkflowState class param if the stateId is provided by default, to make your code cleanerstatic StateDecisionsingleNextStateUntypedInput(Class<? extends WorkflowState> stateClass, Object stateInput) singleNextState as non-strongly typing required for input
-
Constructor Details
-
StateDecision
public StateDecision()
-
-
Method Details
-
getWorkflowConditionalClose
-
getNextStates
-
deadEnd
-
builder
public static io.iworkflow.core.ImmutableStateDecision.Builder builder() -
gracefulCompleteWorkflow
-
gracefulCompleteWorkflow
-
forceCompleteWorkflow
-
forceCompleteWorkflow
-
forceFailWorkflow
-
forceFailWorkflow
-
forceCompleteIfInternalChannelEmptyOrElse
public static <I> StateDecision forceCompleteIfInternalChannelEmptyOrElse(String internalChannelName, Class<? extends WorkflowState<I>> orElseStateClass) -
forceCompleteIfInternalChannelEmptyOrElse
public static <I> StateDecision forceCompleteIfInternalChannelEmptyOrElse(String internalChannelName, Class<? extends WorkflowState<I>> orElseStateClass, I stateInput) -
forceCompleteIfInternalChannelEmptyOrElse
public static <I> StateDecision forceCompleteIfInternalChannelEmptyOrElse(Object completionOutput, String internalChannelName, Class<? extends WorkflowState<I>> orElseStateClass) -
forceCompleteIfInternalChannelEmptyOrElse
public static <I> StateDecision forceCompleteIfInternalChannelEmptyOrElse(Object completionOutput, String internalChannelName, Class<? extends WorkflowState<I>> orElseStateClass, I stateInput) -
forceCompleteIfInternalChannelEmptyOrElse
public static StateDecision forceCompleteIfInternalChannelEmptyOrElse(Object completionOutput, String internalChannelName, StateMovement... orElseStateMovements) Atomically force complete the workflow if internal channel is empty, otherwise trigger the state movements from the current thread This is important for use case that needs to ensure all the messages in the channel are processed before completing the workflow, otherwise messages will be lost. Without this atomic API, if user just check the channel emptiness in the State APIs, the channel may receive new messages during the execution of state APIs- Parameters:
completionOutput- the output of workflow completioninternalChannelName- the internal channel name for checking emptinessorElseStateMovements- the state movements if channel is not empty- Returns:
- the decision
-
forceCompleteIfSignalChannelEmptyOrElse
public static <I> StateDecision forceCompleteIfSignalChannelEmptyOrElse(String signalChannelName, Class<? extends WorkflowState<I>> orElseStateClass) -
forceCompleteIfSignalChannelEmptyOrElse
public static <I> StateDecision forceCompleteIfSignalChannelEmptyOrElse(String signalChannelName, Class<? extends WorkflowState<I>> orElseStateClass, I stateInput) -
forceCompleteIfSignalChannelEmptyOrElse
public static <I> StateDecision forceCompleteIfSignalChannelEmptyOrElse(Object completionOutput, String signalChannelName, Class<? extends WorkflowState<I>> orElseStateClass) -
forceCompleteIfSignalChannelEmptyOrElse
public static <I> StateDecision forceCompleteIfSignalChannelEmptyOrElse(Object completionOutput, String signalChannelName, Class<? extends WorkflowState<I>> orElseStateClass, I stateInput) -
forceCompleteIfSignalChannelEmptyOrElse
public static StateDecision forceCompleteIfSignalChannelEmptyOrElse(Object completionOutput, String signalChannelName, StateMovement... orElseStateMovements) Atomically force complete the workflow if signal channel is empty, otherwise trigger the state movements from the current thread This is important for use case that needs to ensure all the messages in the channel are processed before completing the workflow, otherwise messages will be lost. Without this atomic API, if user just check the channel emptiness in the State APIs, the channel may receive new messages during the execution of state APIs- Parameters:
completionOutput- the output of workflow completionsignalChannelName- the signal channel name for checking emptinessorElseStateMovements- the state movements if channel is not empty- Returns:
- the decision
-
singleNextState
public static <I> StateDecision singleNextState(Class<? extends WorkflowState<I>> stateClass, I stateInput, WorkflowStateOptions stateOptionsOverride) - Type Parameters:
I- Class type of the WorkflowState input- Parameters:
stateClass- requiredstateInput- optional, can be nullstateOptionsOverride- optional, can be null. It is used to override the defined one in the State class- Returns:
- state decision
-
singleNextState
public static <I> StateDecision singleNextState(Class<? extends WorkflowState<I>> stateClass, I stateInput) - Type Parameters:
I- Class type of the WorkflowState input- Parameters:
stateClass- requiredstateInput- optional, can be null- Returns:
- state decision
-
singleNextState
public static <I> StateDecision singleNextState(Class<? extends WorkflowState<I>> stateClass, I stateInput, String waitForKey) - Type Parameters:
I- Class type of the WorkflowState input- Parameters:
stateClass- requiredstateInput- optional, can be nullwaitForKey- key awaited at state completion- Returns:
- state decision
-
singleNextStateUntypedInput
public static StateDecision singleNextStateUntypedInput(Class<? extends WorkflowState> stateClass, Object stateInput) singleNextState as non-strongly typing required for input- Parameters:
stateClass- requiredstateInput- optional, can be null- Returns:
- state decision
-
singleNextState
- Type Parameters:
I- Class type of the WorkflowState input- Parameters:
stateClass- required- Returns:
- state decision
-
singleNextState
public static StateDecision singleNextState(String stateId, Object stateInput, WorkflowStateOptions stateOptionsOverride) use the other one with WorkflowState class param if the stateId is provided by default, to make your code cleaner- Parameters:
stateId- required. StateId of next statestateInput- optional, can be null. Input for next statestateOptionsOverride- optional, can be null. It is used to override the defined one in the State class- Returns:
- state decision
-
singleNextState
public static StateDecision singleNextState(String stateId, Object stateInput, WorkflowStateOptions stateOptionsOverride, String waitForKey) use the other one with WorkflowState class param if the stateId is provided by default, to make your code cleaner- Parameters:
stateId- required. StateId of next statestateInput- optional, can be null. Input for next statestateOptionsOverride- optional, can be null. It is used to override the defined one in the State classwaitForKey- key awaited at state completion- Returns:
- state decision
-
singleNextState
use the other one with WorkflowState class param if the stateId is provided by default, to make your code cleaner- Parameters:
stateId- stateId of next state- Returns:
- state decision
-
multiNextStates
- Parameters:
stateMovements- required- Returns:
- state decision
-
multiNextStates
- Parameters:
stateMovements- required- Returns:
- state decision
-
multiNextStates
use the other one with WorkflowState class param if the stateId is provided by default, to make your code cleaner or use other ones with a list of StateMovement to enable the WorkflowStateOptions overriding- Parameters:
stateIds- stateIds of next states- Returns:
- state decision
-
multiNextStates
use other ones with a list of StateMovement to enable the WorkflowStateOptions overriding- Parameters:
states- required- Returns:
- state decision
-