Package software.amazon.lambda.durable
Class DurableConfig.Builder
java.lang.Object
software.amazon.lambda.durable.DurableConfig.Builder
- Enclosing class:
- DurableConfig
Builder for DurableConfig. Provides fluent API for configuring SDK components.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the DurableConfig instance.withCheckpointDelay(Duration duration) Sets how often the SDK checkpoints updates to backend.withDurableExecutionClient(DurableExecutionClient durableExecutionClient) Sets a custom DurableExecutionClient.withExecutorService(ExecutorService executorService) Sets a custom ExecutorService for running user-defined operations.withLambdaClientBuilder(software.amazon.awssdk.services.lambda.LambdaClientBuilder lambdaClientBuilder) Sets a custom LambdaClient for production use.withLoggerConfig(LoggerConfig loggerConfig) Sets a custom LoggerConfig.withPollingStrategy(PollingStrategy pollingStrategy) Sets the polling strategy.withSerDes(SerDes serDes) Sets a custom SerDes implementation.
-
Method Details
-
withLambdaClientBuilder
public DurableConfig.Builder withLambdaClientBuilder(software.amazon.awssdk.services.lambda.LambdaClientBuilder lambdaClientBuilder) Sets a custom LambdaClient for production use. Use this method to customize the AWS SDK client with specific regions, credentials, timeouts, or retry policies.Example:
LambdaClientBuilder lambdaClientBuilder = LambdaClient.builder() .region(Region.US_WEST_2) .credentialsProvider(ProfileCredentialsProvider.create("my-profile")); DurableConfig.builder() .withLambdaClientBuilder(lambdaClientBuilder) .build();- Parameters:
lambdaClientBuilder- Custom LambdaClientBuilder instance- Returns:
- This builder
- Throws:
NullPointerException- if lambdaClient is null
-
withDurableExecutionClient
public DurableConfig.Builder withDurableExecutionClient(DurableExecutionClient durableExecutionClient) Sets a custom DurableExecutionClient.Note: This method is primarily intended for testing with mock clients (e.g.,
LocalMemoryExecutionClient). For production use with a custom AWS SDK client, preferwithLambdaClientBuilder(LambdaClientBuilder).- Parameters:
durableExecutionClient- Custom DurableExecutionClient instance- Returns:
- This builder
- Throws:
NullPointerException- if durableExecutionClient is null
-
withSerDes
Sets a custom SerDes implementation.- Parameters:
serDes- Custom SerDes instance- Returns:
- This builder
- Throws:
NullPointerException- if serDes is null
-
withExecutorService
Sets a custom ExecutorService for running user-defined operations. If not set, a default cached thread pool will be created.This executor is used exclusively for running user-defined operations. Internal SDK coordination (polling, checkpointing) uses the common ForkJoinPool and is not affected by this setting.
- Parameters:
executorService- Custom ExecutorService instance- Returns:
- This builder
-
withLoggerConfig
Sets a custom LoggerConfig. If not set, defaults to suppressing replay logs.- Parameters:
loggerConfig- Custom LoggerConfig instance- Returns:
- This builder
-
withPollingStrategy
Sets the polling strategy. If not set, defaults to 1 second with full jitter and 2x backoff.- Parameters:
pollingStrategy- Custom PollingStrategy instance- Returns:
- This builder
-
withCheckpointDelay
Sets how often the SDK checkpoints updates to backend. If not set, defaults to 0, which disables checkpoint batching.- Parameters:
duration- the checkpoint delay in Duration- Returns:
- This builder
-
build
Builds the DurableConfig instance.- Returns:
- Immutable DurableConfig instance
-