Class WorkflowStateOptionsExtension

java.lang.Object
io.iworkflow.gen.models.WorkflowStateOptions
io.iworkflow.core.WorkflowStateOptionsExtension

public class WorkflowStateOptionsExtension extends WorkflowStateOptions
WorkflowStateOptionsExtension provides extension to WorkflowStateOptions to make it easier to build some fields of the stateOptions. This is also because WorkflowState interface uses WorkflowStateOptions directly instead of using a separate model. See TODO Example usage in a state implementation: public WorkflowStateOptions getStateOptions() { return new WorkflowStateOptionsExtension() .setProceedAfterRetryExhaustedOnExecute(StateRecoverBasic.class) .executeApiRetryPolicy( new RetryPolicy() .maximumAttempts(10) ); }
  • Constructor Details

    • WorkflowStateOptionsExtension

      public WorkflowStateOptionsExtension()
  • Method Details

    • setProceedWhenExecuteRetryExhausted

      public WorkflowStateOptionsExtension setProceedWhenExecuteRetryExhausted(Class<? extends WorkflowState> proceedingState)
      By default, workflow would fail after execute API retry exhausted. Set the state to proceed to the specified state after the execute API exhausted all retries This is useful for some advanced use cases like SAGA pattern. RetryPolicy is required to be set with maximumAttempts or maximumAttemptsDurationSeconds for execute API. NOTE: The proceeding state will take the same input as the failed state that proceeded from. See more in wiki
      Parameters:
      proceedingState - the state to proceed to
      Returns:
      this
    • setProceedWhenExecuteRetryExhausted

      public WorkflowStateOptionsExtension setProceedWhenExecuteRetryExhausted(Class<? extends WorkflowState> proceedingState, WorkflowStateOptions stateOptionsOverride)
      By default, workflow would fail after execute API retry exhausted. Set the state to proceed to the specified state after the execute API exhausted all retries This is useful for some advanced use cases like SAGA pattern. RetryPolicy is required to be set with maximumAttempts or maximumAttemptsDurationSeconds for execute API. NOTE: The proceeding state will take the same input as the failed state that proceeded from. See more in wiki
      Parameters:
      proceedingState - the state to proceed to
      stateOptionsOverride - the stateOptions for the proceeding state. This is for a rare case that you need to override the stateOptions returned from state instance.
      Returns:
      this
    • setProceedWhenWaitUntilRetryExhausted

      public WorkflowStateOptionsExtension setProceedWhenWaitUntilRetryExhausted(boolean proceed)
      By default, workflow would fail after waitUntil API retry exhausted. If set to true, then after waitUntil API exhausted all retries, proceed to the execute API This is useful for some advanced use cases like SAGA pattern. RetryPolicy is required to be set with maximumAttempts or maximumAttemptsDurationSeconds for waitUntil API. NOTE: execute API will use commandResults to check whether the waitUntil has succeeded or not. See more in wiki
      Parameters:
      proceed - true to proceed
      Returns:
      this
    • setProceedOnExecuteFailure

      @Deprecated public WorkflowStateOptionsExtension setProceedOnExecuteFailure(Class<? extends WorkflowState> proceedingState)
      Deprecated.
      Use setProceedAfterRetryExhaustedOnExecuteFailure instead. It's a renaming for better clarity.
    • setProceedOnExecuteFailure

      @Deprecated public WorkflowStateOptionsExtension setProceedOnExecuteFailure(Class<? extends WorkflowState> proceedingState, WorkflowStateOptions stateOptionsOverride)
      Deprecated.
      Use setProceedAfterRetryExhaustedOnExecuteFailure instead It's a renaming for better clarity.