Class DurableConfig.Builder

java.lang.Object
software.amazon.lambda.durable.DurableConfig.Builder
Enclosing class:
DurableConfig

public static final class DurableConfig.Builder extends Object
Builder for DurableConfig. Provides fluent API for configuring SDK components.
  • Constructor Details

    • Builder

      public Builder()
  • 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, prefer withLambdaClientBuilder(LambdaClientBuilder).

      Parameters:
      durableExecutionClient - Custom DurableExecutionClient instance
      Returns:
      This builder
      Throws:
      NullPointerException - if durableExecutionClient is null
    • withSerDes

      public DurableConfig.Builder withSerDes(SerDes serDes)
      Sets a custom SerDes implementation.
      Parameters:
      serDes - Custom SerDes instance
      Returns:
      This builder
      Throws:
      NullPointerException - if serDes is null
    • withExecutorService

      public DurableConfig.Builder withExecutorService(ExecutorService executorService)
      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 SDK InternalExecutor thread pool and is not affected by this setting.

      Parameters:
      executorService - Custom ExecutorService instance
      Returns:
      This builder
    • withLoggerConfig

      public DurableConfig.Builder withLoggerConfig(LoggerConfig loggerConfig)
      Sets a custom LoggerConfig. If not set, defaults to suppressing replay logs.
      Parameters:
      loggerConfig - Custom LoggerConfig instance
      Returns:
      This builder
    • withPollingStrategy

      public DurableConfig.Builder withPollingStrategy(PollingStrategy pollingStrategy)
      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

      public DurableConfig.Builder withCheckpointDelay(Duration duration)
      Sets how often the SDK checkpoints updates to backend. If not set, defaults to 0, SDK will checkpoint the updates as soon as possible.
      Parameters:
      duration - the checkpoint delay in Duration
      Returns:
      This builder
    • withPlugins

      @Deprecated public DurableConfig.Builder withPlugins(DurableExecutionPlugin... plugins)
      Deprecated.
      This is a preview API that is experimental and may be changed or removed in future releases.
      Registers one or more plugins for lifecycle event instrumentation.

      Plugins receive hooks at invocation, operation, and user function boundaries. Errors thrown by plugins are isolated and never disrupt SDK execution.

      Calling this method replaces any previously registered plugins. Plugins are called in registration order.

      Parameters:
      plugins - the plugins to register
      Returns:
      This builder
      Throws:
      NullPointerException - if any plugin is null
    • build

      public DurableConfig build()
      Builds the DurableConfig instance.
      Returns:
      Immutable DurableConfig instance