Class WorkerOptions.Builder

java.lang.Object
io.superdurable.dex.WorkerOptions.Builder
Enclosing class:
WorkerOptions

public static final class WorkerOptions.Builder extends Object
Builds immutable WorkerOptions values.
  • Method Details

    • pull

      Configures outbound task polling capacity and lifecycle.

      Omitting this setting uses PullWorkerOptions defaults.

      WorkerOptions options = WorkerOptions.newBuilder()
              .serverAddress("dex:8801")
              .pull(PullWorkerOptions.newBuilder().maxConcurrentTasks(8).build())
              .build();
      
      Parameters:
      value - the nonnull pull settings
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if value is null
    • serverAddress

      public WorkerOptions.Builder serverAddress(String value)
      Sets the Dex Server gRPC target used for outbound task streams and API calls.
      Parameters:
      value - the server target; the default is localhost:8801
      Returns:
      this builder
    • credential

      public WorkerOptions.Builder credential(Credential value)
      Sets the token source for Worker FlowService calls and pull stream opens.

      The source can be called concurrently and must not block. A failure ends the call locally; Worker startup throws IllegalStateException on authentication failure, and pull streams retry opening after a backoff. The default null sends no authorization metadata.

      WorkerOptions options = WorkerOptions.newBuilder()
              .serverAddress("dex:8801")
              .pull(PullWorkerOptions.newBuilder().build())
              .credential(new FileCredential("/var/run/secrets/dex/token"))
              .build();
      
      Parameters:
      value - the credential, or null to send no token
      Returns:
      this builder
    • objectMapper

      public WorkerOptions.Builder objectMapper(com.fasterxml.jackson.databind.ObjectMapper value)
      Sets the Jackson mapper used for application values.
      Parameters:
      value - the nonnull application mapper
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if value is null
    • grpcErrorStatusMapping

      public WorkerOptions.Builder grpcErrorStatusMapping(GrpcErrorStatusMapping value)
      Sets how Worker application exceptions map to gRPC status codes.

      The default mapping reports every Step-method and RPC exception as Status.Code.INTERNAL. Use a custom mapping only when an exception class has a stable operational meaning for the owner of the Worker application. The selected status is stored for diagnostics and does not replace Step retry or failure-policy configuration.

      Parameters:
      value - the nonnull immutable exception status mapping
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if value is null
    • attributeIndexSyncTimeout

      public WorkerOptions.Builder attributeIndexSyncTimeout(Duration value)
      Sets the maximum duration for startup index synchronization.
      Parameters:
      value - a positive duration; the default is two minutes
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the duration is null, zero, or negative
    • build

      public WorkerOptions build()
      Builds immutable worker options from the current values.
      Returns:
      the configured worker options