Class MapOperation<I,O>

Type Parameters:
I - the input item type
O - the output result type per item
All Implemented Interfaces:
DurableFuture<MapResult<O>>

public class MapOperation<I,O> extends ConcurrencyOperation<MapResult<O>>
Executes a map operation: applies a function to each item in a collection concurrently, with each item running in its own child context.

Extends ConcurrencyOperation following the same pattern as ParallelOperation. All branches are created upfront in start()/replay(), and results are aggregated into a MapResult in get().

  • Constructor Details

  • Method Details

    • resolveIterationNames

      public static List<String> resolveIterationNames(String mapName, List<?> items, MapConfig config)
      Resolves the operation name for every iteration of a map, applying the config's item namer when present and the default "<mapName>-iteration-N" naming otherwise. A namer that returns null yields an unnamed iteration; any non-null name is validated here.

      SDK-internal. This is the single source of iteration naming for both construction paths: the caller resolves names before an operation ID is allocated, and the legacy constructor resolves them on behalf of callers that do not.

      Parameters:
      mapName - the map operation's name, or null
      items - the map's items, in iteration order
      config - the map configuration supplying the optional item namer
      Returns:
      one name per item, in iteration order
    • start

      protected void start()
      Description copied from class: BaseDurableOperation
      Starts the operation on first execution (no existing checkpoint).
      Specified by:
      start in class BaseDurableOperation
    • replay

      protected void replay(software.amazon.awssdk.services.lambda.model.Operation existing)
      Description copied from class: BaseDurableOperation
      Replays the operation from an existing checkpoint.
      Specified by:
      replay in class BaseDurableOperation
      Parameters:
      existing - the checkpointed operation state
    • handleCompletion

      protected void handleCompletion(CompletionConfig.CompletionDecision completionDecision)
      Description copied from class: ConcurrencyOperation
      Called when the concurrency operation completes. Subclasses define checkpointing behavior.
      Specified by:
      handleCompletion in class ConcurrencyOperation<MapResult<O>>
    • get

      public MapResult<O> get()
      Description copied from interface: DurableFuture
      Blocks until the operation completes and returns the result.

      This delegates to operation.get() which handles: - Thread deregistration (allows suspension) - Thread reactivation (resumes execution) - Result retrieval

      Specified by:
      get in interface DurableFuture<I>
      Specified by:
      get in class SerializableDurableOperation<MapResult<O>>
      Returns:
      the operation result