Class FlowResult

java.lang.Object
io.superdurable.dex.FlowResult

public final class FlowResult extends Object
Describes the observed state and output of a Flow used as a SubFlow or waited on by a client.

A result returned by Client.waitForFlow(String) is always terminal. A result obtained from SubFlow.getConditionResults(Context) may have FlowStatus.RUNNING when a surrounding Wait.anyOf(Condition...) completed first. That running status is a durable snapshot, not a live backend query. Use SubFlow.getFlowId(Context) when an application needs to inspect or stop that SubFlow.

  • Method Details

    • getStatus

      public FlowStatus getStatus()
      Returns the observed Flow status.

      For a SubFlow result, FlowStatus.RUNNING describes the durable snapshot created when the parent Wait completed. It does not guarantee that the SubFlow is still running when this method is called.

      Returns:
      the non-null observed status
    • isTerminal

      public boolean isTerminal()
      Returns whether this result represents a terminal Flow execution.
      Returns:
      false for running or continued-as-new states; otherwise true
    • getErrorType

      public FlowErrorType getErrorType()
      Returns the Dex Flow failure category.
      Returns:
      the category, or null when the Flow did not expose a Dex application error
    • getErrorMessage

      public String getErrorMessage()
      Returns the server-provided failure detail.
      Returns:
      the failure detail, or null when no detail is available
    • getCompletions

      public List<StepCompletion> getCompletions()
      Returns every output-bearing Step completion in server collection order.

      The returned list is immutable. Parallel completion order is not a business ordering contract. A running SubFlow snapshot always returns an empty list.

      Returns:
      an immutable, non-null completion list
    • getSingleOutput

      public <T> T getSingleOutput(Class<T> outputType)
      Decodes the output when exactly one Step completion exists.
      Type Parameters:
      T - the expected output type
      Parameters:
      outputType - the concrete Java output class
      Returns:
      the only decoded Step output
      Throws:
      IllegalStateException - if the result is running or has other than one output
      ValueMappingException - if decoding fails