java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.stepfunctions.Chain
All Implemented Interfaces:
IChainable, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-12-11T23:26:41.878Z") @Stability(Stable) public class Chain extends software.amazon.jsii.JsiiObject implements IChainable
A collection of states to chain onto.

A Chain has a start and zero or more chainable ends. If there are zero ends, calling next() on the Chain will fail.

Example:

 Map map = Map.Builder.create(this, "Map State")
         .maxConcurrency(1)
         .itemsPath(JsonPath.stringAt("$.inputForMap"))
         .itemSelector(Map.of(
                 "item", JsonPath.stringAt("$.Map.Item.Value")))
         .resultPath("$.mapOutput")
         .build();
 // The Map iterator can contain a IChainable, which can be an individual or multiple steps chained together.
 // Below example is with a Choice and Pass step
 Choice choice = new Choice(this, "Choice");
 Condition condition1 = Condition.stringEquals("$.item.status", "SUCCESS");
 Pass step1 = new Pass(this, "Step1");
 Pass step2 = new Pass(this, "Step2");
 Pass finish = new Pass(this, "Finish");
 Chain definition = choice.when(condition1, step1).otherwise(step2).afterwards().next(finish);
 map.itemProcessor(definition);
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode

    Nested classes/interfaces inherited from interface software.amazon.awscdk.services.stepfunctions.IChainable

    IChainable.Jsii$Default, IChainable.Jsii$Proxy
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Chain(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Chain(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Chain
    custom(State startState, List<? extends INextable> endStates, IChainable lastAdded)
    Make a Chain with specific start and end states, and a last-added Chainable.
    The chainable end state(s) of this chain.
    Identify this Chain.
    The start state of this chain.
    Continue normal execution with the given state.
    static Chain
    Make a Chain with the start from one chain and the ends from another.
    static Chain
    Begin a new Chain from one chainable.
    Return a single state that encompasses all states in the chain.
    Return a single state that encompasses all states in the chain.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • Chain

      protected Chain(software.amazon.jsii.JsiiObjectRef objRef)
    • Chain

      protected Chain(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • custom

      @Stability(Stable) @NotNull public static Chain custom(@NotNull State startState, @NotNull List<? extends INextable> endStates, @NotNull IChainable lastAdded)
      Make a Chain with specific start and end states, and a last-added Chainable.

      Parameters:
      startState - This parameter is required.
      endStates - This parameter is required.
      lastAdded - This parameter is required.
    • sequence

      @Stability(Stable) @NotNull public static Chain sequence(@NotNull IChainable start, @NotNull IChainable next)
      Make a Chain with the start from one chain and the ends from another.

      Parameters:
      start - This parameter is required.
      next - This parameter is required.
    • start

      @Stability(Stable) @NotNull public static Chain start(@NotNull IChainable state)
      Begin a new Chain from one chainable.

      Parameters:
      state - This parameter is required.
    • next

      @Stability(Stable) @NotNull public Chain next(@NotNull IChainable next)
      Continue normal execution with the given state.

      Parameters:
      next - This parameter is required.
    • toSingleState

      @Stability(Stable) @NotNull public Parallel toSingleState(@NotNull String id, @Nullable ParallelProps props)
      Return a single state that encompasses all states in the chain.

      This can be used to add error handling to a sequence of states.

      Be aware that this changes the result of the inner state machine to be an array with the result of the state machine in it. Adjust your paths accordingly. For example, change 'outputPath' to '$[0]'.

      Parameters:
      id - This parameter is required.
      props -
    • toSingleState

      @Stability(Stable) @NotNull public Parallel toSingleState(@NotNull String id)
      Return a single state that encompasses all states in the chain.

      This can be used to add error handling to a sequence of states.

      Be aware that this changes the result of the inner state machine to be an array with the result of the state machine in it. Adjust your paths accordingly. For example, change 'outputPath' to '$[0]'.

      Parameters:
      id - This parameter is required.
    • getEndStates

      @Stability(Stable) @NotNull public List<INextable> getEndStates()
      The chainable end state(s) of this chain.
      Specified by:
      getEndStates in interface IChainable
    • getId

      @Stability(Stable) @NotNull public String getId()
      Identify this Chain.
      Specified by:
      getId in interface IChainable
    • getStartState

      @Stability(Stable) @NotNull public State getStartState()
      The start state of this chain.
      Specified by:
      getStartState in interface IChainable