Class LocalMemoryExecutionClient

java.lang.Object
software.amazon.lambda.durable.testing.local.LocalMemoryExecutionClient
All Implemented Interfaces:
software.amazon.lambda.durable.client.DurableExecutionClient

public class LocalMemoryExecutionClient extends Object implements software.amazon.lambda.durable.client.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 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)
      Specified by:
      checkpoint in interface software.amazon.lambda.durable.client.DurableExecutionClient
    • getExecutionState

      public software.amazon.awssdk.services.lambda.model.GetDurableExecutionStateResponse getExecutionState(String arn, String checkpointToken, String marker)
      Specified by:
      getExecutionState in interface software.amazon.lambda.durable.client.DurableExecutionClient
    • getOperationUpdates

      public List<software.amazon.awssdk.services.lambda.model.OperationUpdate> 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

      public void completeChainedInvoke(String name, OperationResult result)
      Completes a chained invoke operation with the given result, simulating a child Lambda response.
    • getOperationByName

      public software.amazon.awssdk.services.lambda.model.Operation getOperationByName(String name)
      Returns the operation with the given name, or null if not found.
    • getAllOperations

      public List<software.amazon.awssdk.services.lambda.model.Operation> getAllOperations()
      Returns all operations currently stored.
    • getUpdatedOperationIdsSinceLastInvocation

      public List<String> getUpdatedOperationIdsSinceLastInvocation()
      Returns the list of operation IDs that have been updated since the last invocation, then clears the tracking set. This simulates the backend's UpdatedOperationIds field behavior.
    • toTestResult

      public <O> TestResult<O> toTestResult(software.amazon.lambda.durable.model.DurableExecutionOutput output, software.amazon.lambda.durable.TypeToken<O> resultType, software.amazon.lambda.durable.serde.SerDes serDes)
      Build TestResult from current state.
    • resetCheckpointToStarted

      public void resetCheckpointToStarted(String stepName)
      Simulate checkpoint failure by forcing an operation into STARTED state
    • simulateFireAndForgetCheckpointLoss

      public void simulateFireAndForgetCheckpointLoss(String stepName)
      Simulate fire-and-forget checkpoint loss by removing the operation entirely
    • getCallbackId

      public String getCallbackId(String operationName)
      Get callback ID for a named callback operation.
    • completeCallback

      public void completeCallback(String callbackId, OperationResult result)
      Simulate external system completing callback.