Class WorkerOptions.Builder
java.lang.Object
io.superdurable.dex.WorkerOptions.Builder
- Enclosing class:
WorkerOptions
Builds immutable
WorkerOptions values.-
Method Summary
Modifier and TypeMethodDescriptionSets the maximum duration for startup index synchronization.build()Builds immutable worker options from the current values.credential(Credential value) Sets the token source for Worker FlowService calls and pull stream opens.Sets how Worker application exceptions map to gRPC status codes.objectMapper(com.fasterxml.jackson.databind.ObjectMapper value) Sets the Jackson mapper used for application values.pull(PullWorkerOptions value) Configures outbound task polling capacity and lifecycle.serverAddress(String value) Sets the Dex Server gRPC target used for outbound task streams and API calls.
-
Method Details
-
pull
Configures outbound task polling capacity and lifecycle.Omitting this setting uses
PullWorkerOptionsdefaults.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
Sets the Dex Server gRPC target used for outbound task streams and API calls.- Parameters:
value- the server target; the default islocalhost:8801- Returns:
- this builder
-
credential
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
IllegalStateExceptionon authentication failure, and pull streams retry opening after a backoff. The defaultnullsends 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, ornullto send no token- Returns:
- this builder
-
objectMapper
Sets the Jackson mapper used for application values.- Parameters:
value- the nonnull application mapper- Returns:
- this builder
- Throws:
IllegalArgumentException- ifvalueisnull
-
grpcErrorStatusMapping
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- ifvalueisnull
-
attributeIndexSyncTimeout
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
Builds immutable worker options from the current values.- Returns:
- the configured worker options
-