Class MapOperation<I,O>
java.lang.Object
software.amazon.lambda.durable.operation.BaseDurableOperation
software.amazon.lambda.durable.operation.SerializableDurableOperation<T>
software.amazon.lambda.durable.operation.ConcurrencyOperation<MapResult<O>>
software.amazon.lambda.durable.operation.MapOperation<I,O>
- Type Parameters:
I- the input item typeO- the output result type per item
- All Implemented Interfaces:
DurableFuture<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().
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.lambda.durable.operation.ConcurrencyOperation
ConcurrencyOperation.ExpectedCompletionStatusNested classes/interfaces inherited from class software.amazon.lambda.durable.operation.SerializableDurableOperation
SerializableDurableOperation.SerializedResult<T> -
Field Summary
Fields inherited from class software.amazon.lambda.durable.operation.ConcurrencyOperation
isJoinedFields inherited from class software.amazon.lambda.durable.operation.BaseDurableOperation
completionFuture, executionManager, isVirtual, parentOperation, replayCompletedOperation -
Constructor Summary
ConstructorsConstructorDescriptionMapOperation(OperationIdentifier operationIdentifier, List<I> items, DurableContext.MapFunction<I, O> function, TypeToken<O> itemResultType, MapConfig config, List<String> iterationNames, DurableContextImpl durableContext) MapOperation(OperationIdentifier operationIdentifier, List<I> items, DurableContext.MapFunction<I, O> function, TypeToken<O> itemResultType, MapConfig config, DurableContextImpl durableContext) -
Method Summary
Modifier and TypeMethodDescriptionget()Blocks until the operation completes and returns the result.protected voidhandleCompletion(CompletionConfig.CompletionDecision completionDecision) Called when the concurrency operation completes.protected voidreplay(software.amazon.awssdk.services.lambda.model.Operation existing) Replays the operation from an existing checkpoint.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.protected voidstart()Starts the operation on first execution (no existing checkpoint).Methods inherited from class software.amazon.lambda.durable.operation.ConcurrencyOperation
createItem, enqueueItem, executeItems, executeItems, getBranches, joinMethods inherited from class software.amazon.lambda.durable.operation.SerializableDurableOperation
deserializeException, deserializeResult, serDesContext, serializeAndDeserializeResult, serializeExceptionMethods inherited from class software.amazon.lambda.durable.operation.BaseDurableOperation
deregisterActiveThread, execute, extractErrorFromOperation, fireOnOperationEnd, getChildOperations, getCompletionFuture, getContext, getCurrentThreadContext, getErrorObject, getName, getOperation, getOperationId, getRunningUserHandler, getSubType, getType, interruptRunningUserHandler, isOperationCompleted, isRunningUserHandlerOwner, markAlreadyCompleted, onCheckpointComplete, pollForOperationUpdates, pollForOperationUpdates, processCheckpointUpdate, registerActiveThread, runUserFunction, runUserHandler, sendOperationUpdate, sendOperationUpdateAsync, terminateExecution, terminateExecutionWithIllegalDurableOperationException, validateReplay, waitForFirstOperationCompletion, waitForOperationCompletion
-
Constructor Details
-
MapOperation
public MapOperation(OperationIdentifier operationIdentifier, List<I> items, DurableContext.MapFunction<I, O> function, TypeToken<O> itemResultType, MapConfig config, DurableContextImpl durableContext) -
MapOperation
public MapOperation(OperationIdentifier operationIdentifier, List<I> items, DurableContext.MapFunction<I, O> function, TypeToken<O> itemResultType, MapConfig config, List<String> iterationNames, DurableContextImpl durableContext)
-
-
Method Details
-
resolveIterationNames
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 nullitems- the map's items, in iteration orderconfig- the map configuration supplying the optional item namer- Returns:
- one name per item, in iteration order
-
start
protected void start()Description copied from class:BaseDurableOperationStarts the operation on first execution (no existing checkpoint).- Specified by:
startin classBaseDurableOperation
-
replay
protected void replay(software.amazon.awssdk.services.lambda.model.Operation existing) Description copied from class:BaseDurableOperationReplays the operation from an existing checkpoint.- Specified by:
replayin classBaseDurableOperation- Parameters:
existing- the checkpointed operation state
-
handleCompletion
Description copied from class:ConcurrencyOperationCalled when the concurrency operation completes. Subclasses define checkpointing behavior.- Specified by:
handleCompletionin classConcurrencyOperation<MapResult<O>>
-
get
Description copied from interface:DurableFutureBlocks 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:
getin interfaceDurableFuture<I>- Specified by:
getin classSerializableDurableOperation<MapResult<O>>- Returns:
- the operation result
-