Skip to content

Latest commit

 

History

History
97 lines (71 loc) · 3.32 KB

File metadata and controls

97 lines (71 loc) · 3.32 KB

AWS Lambda Durable Execution SDK Examples

Example applications demonstrating the AWS Lambda Durable Execution SDK for Java.

Prerequisites

  • Java 17+
  • Maven 3.8+
  • AWS SAM CLI (for deployment)
  • Docker (for SAM build)
  • AWS credentials configured

Local Testing

Run examples locally without deploying to AWS using LocalDurableTestRunner:

# Build and install the SDK to local Maven repo (required since SDK is not yet published)
mvn clean install -DskipTests   # from project root

cd examples

# Run all tests
mvn test

# Run specific test
mvn test -Dtest=SimpleStepExampleTest

The local runner executes in-memory and skips wait durations—ideal for fast iteration and CI/CD.

Deploy to AWS

cd examples
mvn clean package
sam build
sam deploy --guided

On first deploy, SAM will prompt for stack name and region. Subsequent deploys use saved config:

sam deploy

The SAM template configures:

  • DurableConfig with ExecutionTimeout and RetentionPeriodInDays
  • IAM permissions for lambda:CheckpointDurableExecutions and lambda:GetDurableExecutionState

Invoke Deployed Functions

sam remote invoke SimpleStepExampleFunction \
  --event '{"name":"World"}' \
  --stack-name durable-sdk-examples

Cloud Integration Tests

Run tests against deployed functions using CloudDurableTestRunner:

cd examples
mvn test -Dtest=CloudBasedIntegrationTest -Dtest.cloud.enabled=true

The tests auto-detect your AWS account and region from credentials. Override if needed:

mvn test -Dtest=CloudBasedIntegrationTest \
  -Dtest.cloud.enabled=true \
  -Dtest.aws.account=123456789012 \
  -Dtest.aws.region=us-east-1

Examples

Example Description
SimpleStepExample Basic sequential steps
WaitExample Suspend execution with wait()
RetryExample Configuring retry strategies
ErrorHandlingExample Handling StepFailedException and StepInterruptedException
GenericTypesExample Working with List<T> and Map<K,V>
CustomConfigExample Custom Lambda client and SerDes
WaitAtLeastExample Concurrent stepAsync() with wait()
WaitAsyncExample Non-blocking waitAsync() with concurrent step
RetryInProcessExample In-process retry with concurrent operations
WaitAtLeastInProcessExample Wait completes before async step (no suspension)
ManyAsyncStepsExample Performance test with 500 concurrent async steps

Cleanup

sam delete