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.withLambdaClient(software.amazon.awssdk.services.lambda.LambdaClient lambdaClient) Sets a custom LambdaClient for production use.withLoggerConfig(LoggerConfig loggerConfig) Sets a custom LoggerConfig.withPollingInterval(Duration duration) Sets how often the SDK polls updates from backend.withSerDes(SerDes serDes) Sets a custom SerDes implementation.
-
Method Details
-
withLambdaClient
public DurableConfig.Builder withLambdaClient(software.amazon.awssdk.services.lambda.LambdaClient lambdaClient) 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:
LambdaClient lambdaClient = LambdaClient.builder() .region(Region.US_WEST_2) .credentialsProvider(ProfileCredentialsProvider.create("my-profile")) .build(); DurableConfig.builder() .withLambdaClient(lambdaClient) .build();- Parameters:
lambdaClient- Custom LambdaClient 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, preferwithLambdaClient(LambdaClient).- 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
-
withPollingInterval
Sets how often the SDK polls updates from backend.- Parameters:
duration- the polling interval in Duration- 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
-