java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IChainable, INextable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-06T23:25:17.560Z") @Stability(Stable) public class Map extends MapBase implements INextable
Define a Map state in the state machine.

A Map state can be used to run a set of steps for each element of an input array. A Map state will execute the same steps for multiple entries of an array in the state input.

While the Parallel state executes multiple branches of steps using the same input, a Map state will execute the same steps for multiple entries of an array in the state input.

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);
 

See Also:
  • Constructor Details

    • Map

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

      protected Map(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Map

      @Stability(Stable) public Map(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable MapProps props)
      Parameters:
      scope - This parameter is required.
      id - Descriptive identifier for this chainable. This parameter is required.
      props -
    • Map

      @Stability(Stable) public Map(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - Descriptive identifier for this chainable. This parameter is required.
  • Method Details

    • addCatch

      @Stability(Stable) @NotNull public Map addCatch(@NotNull IChainable handler, @Nullable CatchProps props)
      Add a recovery handler for this state.

      When a particular error occurs, execution will continue at the error handler instead of failing the state machine execution.

      Parameters:
      handler - This parameter is required.
      props -
    • addCatch

      @Stability(Stable) @NotNull public Map addCatch(@NotNull IChainable handler)
      Add a recovery handler for this state.

      When a particular error occurs, execution will continue at the error handler instead of failing the state machine execution.

      Parameters:
      handler - This parameter is required.
    • addRetry

      @Stability(Stable) @NotNull public Map addRetry(@Nullable RetryProps props)
      Add retry configuration for this state.

      This controls if and how the execution will be retried if a particular error occurs.

      Parameters:
      props -
    • addRetry

      @Stability(Stable) @NotNull public Map addRetry()
      Add retry configuration for this state.

      This controls if and how the execution will be retried if a particular error occurs.

    • itemProcessor

      @Stability(Stable) @NotNull public Map itemProcessor(@NotNull IChainable processor, @Nullable ProcessorConfig config)
      Define item processor in Map.

      A Map must either have a non-empty iterator or a non-empty item processor (mutually exclusive with iterator).

      Parameters:
      processor - This parameter is required.
      config -
    • itemProcessor

      @Stability(Stable) @NotNull public Map itemProcessor(@NotNull IChainable processor)
      Define item processor in Map.

      A Map must either have a non-empty iterator or a non-empty item processor (mutually exclusive with iterator).

      Parameters:
      processor - This parameter is required.
    • iterator

      @Stability(Deprecated) @Deprecated @NotNull public Map iterator(@NotNull IChainable iterator)
      Deprecated.
      • use itemProcessor instead.
      (deprecated) Define iterator state machine in Map.

      A Map must either have a non-empty iterator or a non-empty item processor (mutually exclusive with itemProcessor).

      Parameters:
      iterator - This parameter is required.
    • toStateJson

      @Stability(Stable) @NotNull public com.fasterxml.jackson.databind.node.ObjectNode toStateJson()
      Return the Amazon States Language object for this state.
      Overrides:
      toStateJson in class MapBase
    • validateState

      @Stability(Stable) @NotNull protected List<String> validateState()
      Validate this state.
      Overrides:
      validateState in class MapBase