https://github.com/aws/aws-durable-execution-sdk-java
Java SDK for AWS Lambda Durable Functions
https://github.com/aws/aws-durable-execution-sdk-java
aws durable-execution java lambda serverless
Last synced: 7 days ago
JSON representation
Java SDK for AWS Lambda Durable Functions
- Host: GitHub
- URL: https://github.com/aws/aws-durable-execution-sdk-java
- Owner: aws
- License: apache-2.0
- Created: 2025-12-29T07:06:31.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-04-06T21:39:38.000Z (8 days ago)
- Last Synced: 2026-04-06T23:23:01.960Z (8 days ago)
- Topics: aws, durable-execution, java, lambda, serverless
- Language: Java
- Homepage: https://docs.aws.amazon.com/lambda/latest/dg/durable-functions.html
- Size: 13.5 MB
- Stars: 26
- Watchers: 2
- Forks: 7
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Notice: NOTICE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# AWS Lambda Durable Execution SDK for Java
[](https://opensource.org/licenses/Apache-2.0)
[](https://openjdk.org/)
[](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/build.yml)
[](https://aws.github.io/aws-durable-execution-sdk-java/javadoc/)
[](https://mvnrepository.com/artifact/software.amazon.lambda.durable/aws-durable-execution-sdk-java)
[](https://aws.github.io/aws-durable-execution-sdk-java/coverage/)
[](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/e2e-tests.yml)
[](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/github-code-scanning/codeql)
[](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/check-spotless.yml)
[](https://github.com/orgs/aws/projects/346/views/6)
Build resilient, long-running AWS Lambda functions that automatically checkpoint progress and resume after failures. Durable functions can run for up to one year while you pay only for active compute time.
## Key Features
- **Automatic Checkpointing** – Progress is saved after each step; failures resume from the last checkpoint
- **Cost-Effective Waits** – Suspend execution for minutes, hours, or days without compute charges
- **Configurable Retries** – Built-in retry strategies with exponential backoff and jitter
- **Replay Safety** – Functions deterministically resume from checkpoints after interruptions
- **Type Safety** – Full generic type support for step results
- **Data-Driven Concurrency** – Apply a function across a collection with `map()`, with per-item error isolation and configurable completion criteria
## How It Works
Your durable function extends `DurableHandler` and implements `handleRequest(I input, DurableContext ctx)`. The `DurableContext` is your interface to durable operations:
- `ctx.step()` – Execute code and checkpoint the result
- `ctx.wait()` – Suspend execution without compute charges
- `ctx.createCallback()` – Wait for external events (approvals, webhooks)
- `ctx.waitForCallback()` – Simplify callback handling by combining callback creation and submission in one operation
- `ctx.invoke()` – Invoke another Lambda function and wait for the result
- `ctx.runInChildContext()` – Run an isolated child context with its own checkpoint log
- `ctx.map()` – Apply a function to each item in a collection concurrently
- `ctx.parallel()` - Run multiple operations concurrently with optional concurrency control
- `ctx.waitForCondition()` – Poll a condition function until it signals done, suspending between polls
## Quick Start
### Installation
```xml
software.amazon.lambda.durable
aws-durable-execution-sdk-java
VERSION
```
### Your First Durable Function
```java
public class OrderProcessor extends DurableHandler {
@Override
protected OrderResult handleRequest(Order order, DurableContext ctx) {
// Step 1: Validate and reserve inventory
var reservation = ctx.step("reserve-inventory", Reservation.class,
stepCtx -> inventoryService.reserve(order.getItems()));
// Step 2: Process payment
var payment = ctx.step("process-payment", Payment.class,
stepCtx -> paymentService.charge(order.getPaymentMethod(), order.getTotal()));
// Wait for warehouse processing (no compute charges)
ctx.wait(null, Duration.ofHours(2));
// Step 3: Confirm shipment
var shipment = ctx.step("confirm-shipment", Shipment.class,
stepCtx -> shippingService.ship(reservation, order.getAddress()));
return new OrderResult(order.getId(), shipment.getTrackingNumber());
}
}
```
## Deployment
See [examples/README.md](./examples/README.md) for complete instructions on local testing and running cloud integration tests.
See [Deploy and invoke Lambda durable functions with the AWS CLI](https://docs.aws.amazon.com/lambda/latest/dg/durable-getting-started-cli.html) for more information on deploying and invoking durable functions.
See [Deploy Lambda durable functions with Infrastructure as Code](https://docs.aws.amazon.com/lambda/latest/dg/durable-getting-started-iac.html) for more information on deploying durable functions using infrastructure-as-code.
## Documentation
- [AWS Documentation](https://docs.aws.amazon.com/lambda/latest/dg/durable-functions.html) – Official AWS Lambda durable functions guide
- [Best Practices](https://docs.aws.amazon.com/lambda/latest/dg/durable-best-practices.html) – Patterns and recommendations
- [SDK Design](docs/design.md) – Details of SDK internal architecture
**Core Operations**
- [Steps](docs/core/steps.md) – Execute code with automatic checkpointing and retry support
- [Wait](docs/core/wait.md) - Pause execution without blocking Lambda resources
- [Callbacks](docs/core/callbacks.md) - Wait for external systems to respond
- [Invoke](docs/core/invoke.md) - Call other durable functions
- [Child Contexts](docs/core/child-contexts.md) - Organize complex workflows into isolated units
- [Map](docs/core/map.md) - Apply a function across a collection concurrently
- [Parallel](docs/core/parallel.md) - Run multiple operations concurrently with optional concurrency control
- [Wait for Condition](docs/core/wait-for-condition.md) - Poll a condition until it's met, with configurable backoff
**Examples**
- [Examples](examples/README.md) - Working examples of each operation
**Advanced Topics**
- [Configuration](docs/advanced/configuration.md) - Customize SDK behaviour
- [Error Handling](docs/advanced/error-handling.md) - SDK exceptions for handling failures
- [Logging](docs/advanced/logging.md) - How to use DurableLogger
- [Testing](docs/advanced/testing.md) - Utilities for local development and cloud-based integration testing
## Related SDKs
- [JavaScript/TypeScript SDK](https://github.com/aws/aws-durable-execution-sdk-js)
- [Python SDK](https://github.com/aws/aws-durable-execution-sdk-python)
## Security
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for information about reporting security issues.
## License
This project is licensed under the Apache-2.0 License. See [LICENSE](LICENSE) for details.