Class LocalMemoryExecutionClient
java.lang.Object
software.amazon.lambda.durable.testing.local.LocalMemoryExecutionClient
- All Implemented Interfaces:
DurableExecutionClient
In-memory implementation of
DurableExecutionClient for local testing. Stores operations and checkpoint state
in memory, simulating the durable execution backend without AWS infrastructure.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdvance all operations (simulates time passing for retries/waits).software.amazon.awssdk.services.lambda.model.CheckpointDurableExecutionResponsecheckpoint(String arn, String token, List<software.amazon.awssdk.services.lambda.model.OperationUpdate> updates) Sends a batch of operation updates to the backend.voidcompleteCallback(String callbackId, OperationResult result) Simulate external system completing callback.voidcompleteChainedInvoke(String name, OperationResult result) Completes a chained invoke operation with the given result, simulating a child Lambda response.List<software.amazon.awssdk.services.lambda.model.Operation>Returns all operations currently stored.getCallbackId(String operationName) Get callback ID for a named callback operation.software.amazon.awssdk.services.lambda.model.GetDurableExecutionStateResponsegetExecutionState(String arn, String checkpointToken, String marker) Retrieves the current execution state from the backend.software.amazon.awssdk.services.lambda.model.OperationgetOperationByName(String name) Returns the operation with the given name, or null if not found.List<software.amazon.awssdk.services.lambda.model.OperationUpdate>Get all operation updates that have been sent to this client.voidresetCheckpointToStarted(String stepName) Simulate checkpoint failure by forcing an operation into STARTED statevoidsimulateFireAndForgetCheckpointLoss(String stepName) Simulate fire-and-forget checkpoint loss by removing the operation entirely<O> TestResult<O>toTestResult(DurableExecutionOutput output, TypeToken<O> resultType, SerDes serDes) Build TestResult from current state.
-
Constructor Details
-
LocalMemoryExecutionClient
public LocalMemoryExecutionClient()
-
-
Method Details
-
checkpoint
public software.amazon.awssdk.services.lambda.model.CheckpointDurableExecutionResponse checkpoint(String arn, String token, List<software.amazon.awssdk.services.lambda.model.OperationUpdate> updates) Description copied from interface:DurableExecutionClientSends a batch of operation updates to the backend.- Specified by:
checkpointin interfaceDurableExecutionClient- Parameters:
arn- the durable execution ARNtoken- the checkpoint tokenupdates- the operation updates to send- Returns:
- the checkpoint response
-
getExecutionState
public software.amazon.awssdk.services.lambda.model.GetDurableExecutionStateResponse getExecutionState(String arn, String checkpointToken, String marker) Description copied from interface:DurableExecutionClientRetrieves the current execution state from the backend.- Specified by:
getExecutionStatein interfaceDurableExecutionClient- Parameters:
arn- the durable execution ARNcheckpointToken- the checkpoint tokenmarker- pagination marker, or null for the first page- Returns:
- the execution state response
-
getOperationUpdates
Get all operation updates that have been sent to this client. Useful for testing and verification. -
advanceTime
public boolean advanceTime()Advance all operations (simulates time passing for retries/waits).- Returns:
- true if any operations were advanced, false otherwise
-
completeChainedInvoke
Completes a chained invoke operation with the given result, simulating a child Lambda response. -
getOperationByName
Returns the operation with the given name, or null if not found. -
getAllOperations
Returns all operations currently stored. -
toTestResult
public <O> TestResult<O> toTestResult(DurableExecutionOutput output, TypeToken<O> resultType, SerDes serDes) Build TestResult from current state. -
resetCheckpointToStarted
Simulate checkpoint failure by forcing an operation into STARTED state -
simulateFireAndForgetCheckpointLoss
Simulate fire-and-forget checkpoint loss by removing the operation entirely -
getCallbackId
Get callback ID for a named callback operation. -
completeCallback
Simulate external system completing callback.
-