Class SubFlowOptions.Builder

java.lang.Object
io.superdurable.dex.SubFlowOptions.Builder
Enclosing class:
SubFlowOptions

public static final class SubFlowOptions.Builder extends Object
Builds immutable SubFlow options.

A builder can be reused; each built value owns an immutable copy of its Attribute initializations.

  • Method Details

    • timeout

      public SubFlowOptions.Builder timeout(Duration value)
      Sets Dex's durable soft timeout for the SubFlow execution.
      Parameters:
      value - a nonnegative whole-second duration, or null for no explicit timeout
      Returns:
      this builder
      Throws:
      IllegalArgumentException - during condition mapping if the duration is unsupported
    • timeoutPolicy

      public SubFlowOptions.Builder timeoutPolicy(FlowTimeoutPolicy value)
      Sets the action taken when the positive SubFlow timeout expires.

      The default invokes the target Flow's overridden Flow.handleTimeout(Context); otherwise it fails the SubFlow. HANDLER requires that override.

      Parameters:
      value - the non-null timeout policy
      Returns:
      this builder
      Throws:
      NullPointerException - if value is null
    • timeoutHandlerOptions

      public SubFlowOptions.Builder timeoutHandlerOptions(FlowTimeoutHandlerOptions value)
      Configures timeout-handler execution and selective state loading.

      This option requires a positive timeout and a policy resolving to HANDLER.

      Parameters:
      value - the handler options, or null for server defaults
      Returns:
      this builder
    • startDelay

      public SubFlowOptions.Builder startDelay(Duration value)
      Sets the delay before the SubFlow starts.
      Parameters:
      value - a nonnegative whole-second duration, or null for no explicit delay
      Returns:
      this builder
      Throws:
      IllegalArgumentException - during condition mapping if the duration is unsupported
    • retryPolicy

      public SubFlowOptions.Builder retryPolicy(RetryPolicy value)
      Sets retry behavior for abnormal SubFlow completion.
      Parameters:
      value - the Flow retry policy, or null for no explicit policy
      Returns:
      this builder
    • addAttribute

      public <T> SubFlowOptions.Builder addAttribute(Attribute<T> attribute, T value)
      Adds one initial static Attribute value to the SubFlow start.
      Type Parameters:
      T - the Attribute value type
      Parameters:
      attribute - an Attribute registered by the target SubFlow
      value - the initial value, including null when supported by its value type
      Returns:
      this builder
      Throws:
      NullPointerException - if attribute is null
    • addAttribute

      public <T> SubFlowOptions.Builder addAttribute(AttributeMap<T> attribute, String instance, T value)
      Adds one initial Attribute-map value to the SubFlow start.
      Type Parameters:
      T - the Attribute value type
      Parameters:
      attribute - an Attribute map registered by the target SubFlow
      instance - the map instance. Slash is prohibited because it is a reserved character
      value - the initial value, including null when supported by its value type
      Returns:
      this builder
      Throws:
      NullPointerException - if attribute is null
      IllegalArgumentException - if instance is blank or contains /
    • configOverride

      public SubFlowOptions.Builder configOverride(FlowConfig value)
      Overrides fields in the parent Flow's effective configuration for the SubFlow.
      Parameters:
      value - the partial Flow configuration, or null for no overrides
      Returns:
      this builder
    • reusePolicy

      public SubFlowOptions.Builder reusePolicy(SubFlowReusePolicy value)
      Sets how an execution already using the generated Flow ID is resolved.
      Parameters:
      value - the non-null reuse policy
      Returns:
      this builder
      Throws:
      NullPointerException - if value is null
    • conditionId

      public SubFlowOptions.Builder conditionId(String value)
      Sets the condition ID required by Wait.anyCombinationOf(ConditionCombination...).
      Parameters:
      value - the stable condition ID, or null outside any-combination waits
      Returns:
      this builder
      Throws:
      InvalidStepResultException - during condition mapping if the ID is empty or duplicates another condition
    • build

      public SubFlowOptions build()
      Builds immutable options.
      Returns:
      a new immutable options value