Class AsyncExecution<O>

java.lang.Object
software.amazon.lambda.durable.testing.AsyncExecution<O>

public class AsyncExecution<O> extends Object
Handle for an asynchronously executing durable function. Allows incremental polling and inspection of execution state.
  • Constructor Details

    • AsyncExecution

      public AsyncExecution(String executionArn, software.amazon.awssdk.services.lambda.LambdaClient lambdaClient, TypeToken<O> outputType, SerDes serDes, Duration pollInterval, Duration timeout)
  • Method Details

    • pollUntil

      public AsyncExecution<O> pollUntil(Predicate<AsyncExecution<O>> condition)
      Poll execution history until the given condition is met.
      Parameters:
      condition - predicate to test on each poll
      Returns:
      this execution for chaining
    • pollUntilComplete

      public TestResult<O> pollUntilComplete()
      Poll until execution completes and return the final result.
      Returns:
      test result with execution status and output
    • isComplete

      public boolean isComplete()
      Check if execution has completed (succeeded or failed).
    • hasOperation

      public boolean hasOperation(String name)
      Check if an operation with the given name exists.
    • hasCallback

      public boolean hasCallback(String name)
      Check if a callback operation with the given name exists and is started.
    • getCallbackId

      public String getCallbackId(String operationName)
      Get the callback ID for a callback operation.
      Parameters:
      operationName - name of the callback operation
      Returns:
      callback ID
      Throws:
      IllegalStateException - if no callback found for operation
    • getOperation

      public TestOperation getOperation(String name)
      Get details for a specific operation.
    • getOperations

      public List<TestOperation> getOperations()
      Get all operations in the execution.
    • getStatus

      public ExecutionStatus getStatus()
      Get current execution status.
    • getExecutionArn

      public String getExecutionArn()
      Get the execution ARN.
    • completeCallback

      public void completeCallback(String callbackId, String result)
      calls sendDurableExecutionCallbackSuccess with the given callbackId and result
    • failCallback

      public void failCallback(String callbackId, software.amazon.awssdk.services.lambda.model.ErrorObject error)
      calls sendDurableExecutionCallbackFailure with the give callbackId and error
    • heartbeatCallback

      public void heartbeatCallback(String callbackId)
      call sendDurableExecutionCallbackHeartbeat API with the give callbackId