Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions docs/advanced/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ public class OrderProcessor extends DurableHandler<Order, OrderResult> {
@Override
protected DurableConfig createConfiguration() {
// Custom Lambda client with connection pooling
var lambdaClient = LambdaClient.builder()
var lambdaClientBuilder = LambdaClient.builder()
.httpClient(ApacheHttpClient.builder()
.maxConnections(50)
.connectionTimeout(Duration.ofSeconds(30))
.build())
.build();
.build());

return DurableConfig.builder()
.withLambdaClient(lambdaClient)
.withLambdaClientBuilder(lambdaClientBuilder)
.withSerDes(new MyCustomSerDes()) // Custom serialization
.withExecutorService(Executors.newFixedThreadPool(10)) // Custom thread pool
.withLoggerConfig(LoggerConfig.withReplayLogging()) // Enable replay logs
Expand All @@ -30,11 +29,11 @@ public class OrderProcessor extends DurableHandler<Order, OrderResult> {
}
```

| Option | Description | Default |
|--------|-------------|---------|
| `withLambdaClient()` | Custom AWS Lambda client | Auto-configured Lambda client |
| `withSerDes()` | Serializer for step results | Jackson with default settings |
| `withExecutorService()` | Thread pool for user-defined operations | Cached daemon thread pool |
| `withLoggerConfig()` | Logger behavior configuration | Suppress logs during replay |
| Option | Description | Default |
|-----------------------------|-----------------------------------------|-------------------------------|
| `withLambdaClientBuilder()` | Custom AWS Lambda client | Auto-configured Lambda client |
| `withSerDes()` | Serializer for step results | Jackson with default settings |
| `withExecutorService()` | Thread pool for user-defined operations | Cached daemon thread pool |
| `withLoggerConfig()` | Logger behavior configuration | Suppress logs during replay |

The `withExecutorService()` option configures the thread pool used for running user-defined operations. Internal SDK coordination (checkpoint batching, polling) runs on an SDK-managed thread pool.
28 changes: 14 additions & 14 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ public class MyHandler extends DurableHandler<Input, Output> {
@Override
protected DurableConfig createConfiguration() {
return DurableConfig.builder()
.withLambdaClient(customLambdaClient)
.withLambdaClientBuilder(customLambdaClientBuilder)
.withSerDes(new CustomSerDes())
.withExecutorService(Executors.newFixedThreadPool(4))
.build();
}
}
```

| Option | Default |
|--------|---------|
| `lambdaClient` | Auto-created `LambdaClient` for current region, primed for performance (see [`DurableConfig.java`](../sdk/src/main/java/com/amazonaws/lambda/durable/DurableConfig.java)) |
| `serDes` | `JacksonSerDes` |
| `executorService` | `Executors.newCachedThreadPool()` (for user-defined operations only) |
| `loggerConfig` | `LoggerConfig.defaults()` (suppress replay logs) |
| Option | Default |
|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `lambdaClientBuilder` | Auto-created `LambdaClient` for current region, primed for performance (see [`DurableConfig.java`](../sdk/src/main/java/com/amazonaws/lambda/durable/DurableConfig.java)) |
| `serDes` | `JacksonSerDes` |
| `executorService` | `Executors.newCachedThreadPool()` (for user-defined operations only) |
| `loggerConfig` | `LoggerConfig.defaults()` (suppress replay logs) |

### Thread Pool Architecture

Expand Down Expand Up @@ -507,7 +507,7 @@ Implementations:
- `LambdaDurableFunctionsClient` - Production (wraps AWS SDK)
- `LocalMemoryExecutionClient` - Testing (in-memory)

For production customization, use `DurableConfig.builder().withLambdaClient(lambdaClient)`.
For production customization, use `DurableConfig.builder().withLambdaClientBuilder(lambdaClientBuilder)`.
For testing, use `DurableConfig.builder().withDurableExecutionClient(localMemoryClient)`.

---
Expand Down Expand Up @@ -734,12 +734,12 @@ When a context thread calls `ctx.step(...)`, the following coordination occurs:

### Sequence: Wait with Suspension

| Seq | Context Thread | System Thread |
|-----|--------------------------------------------------------------------------------------------------------------------------------|------------------------|
| 1 | Create `WaitOperation` + `completionFuture`. Call `execute()`. `execute()` calls `start()` → checkpoint WAIT with duration → `pollForOperationUpdates(remainingWaitTime)`. | Begin polling backend. |
| 2 | `wait()` calls `get()` → `waitForOperationCompletion()`. Attach `thenRun(re-register)`. Deregister context thread. | (polling) |
| 3 | `activeThreads` is empty → `suspendExecution()` → `executionExceptionFuture.completeExceptionally(SuspendExecutionException)`. | — |
| 4 | `runUntilCompleteOrSuspend` resolves with `SuspendExecutionException` → return `PENDING`. | — |
| Seq | Context Thread | System Thread |
|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------|
| 1 | Create `WaitOperation` + `completionFuture`. Call `execute()`. `execute()` calls `start()` → checkpoint WAIT with duration → `pollForOperationUpdates(remainingWaitTime)`. | Begin polling backend. |
| 2 | `wait()` calls `get()` → `waitForOperationCompletion()`. Attach `thenRun(re-register)`. Deregister context thread. | (polling) |
| 3 | `activeThreads` is empty → `suspendExecution()` → `executionExceptionFuture.completeExceptionally(SuspendExecutionException)`. | — |
| 4 | `runUntilCompleteOrSuspend` resolves with `SuspendExecutionException` → return `PENDING`. | — |

On re-invocation, the wait replays. If the scheduled end time has passed, `markAlreadyCompleted()` fires and the context thread continues without deregistering.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@
* <pre>{@code
* @Override
* protected DurableConfig createConfiguration() {
* LambdaClient lambdaClient = LambdaClient.builder()
* LambdaClientBuilder lambdaClientBuilder = LambdaClient.builder()
* .region(Region.US_WEST_2)
* .credentialsProvider(ProfileCredentialsProvider.create("my-profile"))
* .build();
* .credentialsProvider(ProfileCredentialsProvider.create("my-profile"));
*
* return DurableConfig.builder()
* .withLambdaClient(lambdaClient)
* .withLambdaClientBuilder(lambdaClientBuilder)
* .build();
* }
* }</pre>
Expand Down
Loading
Loading