Package io.temporal.serviceclient
Class RpcRetryOptions.Builder
- java.lang.Object
-
- io.temporal.serviceclient.RpcRetryOptions.Builder
-
- Enclosing class:
- RpcRetryOptions
public static final class RpcRetryOptions.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RpcRetryOptions.Builder
addDoNotRetry(io.grpc.Status.Code code, java.lang.Class<? extends com.google.protobuf.GeneratedMessageV3> detailsClass)
AddStatus.Code
with associated details class to not retry.RpcRetryOptions.Builder
addDoNotRetry(RpcRetryOptions.DoNotRetryItem doNotRetryItem)
AddRpcRetryOptions.DoNotRetryItem
to not retry.RpcRetryOptions
build()
Build RetryOptions without performing validation as validation should be done after merging with MethodRetry.RpcRetryOptions
buildWithDefaultsFrom(RpcRetryOptions rpcRetryOptions)
RpcRetryOptions.Builder
setBackoffCoefficient(double backoffCoefficient)
Coefficient used to calculate the next retry interval.RpcRetryOptions.Builder
setExpiration(java.time.Duration expiration)
Maximum time to retry.RpcRetryOptions.Builder
setInitialInterval(java.time.Duration initialInterval)
Interval of the first retry.RpcRetryOptions.Builder
setMaximumAttempts(int maximumAttempts)
When exceeded the amount of attempts, stop.RpcRetryOptions.Builder
setMaximumInterval(java.time.Duration maximumInterval)
Maximum interval between retries.RpcRetryOptions.Builder
setRetryOptions(RpcRetryOptions o)
The parameter options takes precedence.RpcRetryOptions
validateBuildWithDefaults()
Validates property values and builds RetryOptions with default values.
-
-
-
Method Detail
-
setInitialInterval
public RpcRetryOptions.Builder setInitialInterval(java.time.Duration initialInterval)
Interval of the first retry. If coefficient is 1.0 then it is used for all retries. Required.
-
setExpiration
public RpcRetryOptions.Builder setExpiration(java.time.Duration expiration)
Maximum time to retry. Required. When exceeded the retries stop even if maximum retries is not reached yet.
-
setBackoffCoefficient
public RpcRetryOptions.Builder setBackoffCoefficient(double backoffCoefficient)
Coefficient used to calculate the next retry interval. The next retry interval is previous interval multiplied by this coefficient. Must be 1 or larger. Default is 2.0.
-
setMaximumAttempts
public RpcRetryOptions.Builder setMaximumAttempts(int maximumAttempts)
When exceeded the amount of attempts, stop. Even if expiration time is not reached.
Default is unlimited.- Parameters:
maximumAttempts
- Maximum number of attempts. Default will be used if set to0
.
-
setMaximumInterval
public RpcRetryOptions.Builder setMaximumInterval(java.time.Duration maximumInterval)
Maximum interval between retries. Exponential backoff leads to interval increase. This value is the cap of the increase.
Default is 100x of initial interval. Can't be less thansetInitialInterval(Duration)
- Parameters:
maximumInterval
- the maximum interval value. Default will be used if set tonull
.
-
addDoNotRetry
public RpcRetryOptions.Builder addDoNotRetry(io.grpc.Status.Code code, java.lang.Class<? extends com.google.protobuf.GeneratedMessageV3> detailsClass)
AddStatus.Code
with associated details class to not retry. IfdetailsClass
is null all failures with the code are non retryable.Status.Code.CANCELLED
andStatus.Code.DEADLINE_EXCEEDED
are always considered non-retryable.
-
addDoNotRetry
public RpcRetryOptions.Builder addDoNotRetry(RpcRetryOptions.DoNotRetryItem doNotRetryItem)
AddRpcRetryOptions.DoNotRetryItem
to not retry. IfDoNotRetryItem#detailsClass
is null all failures with the code are non retryable.Status.Code.CANCELLED
andStatus.Code.DEADLINE_EXCEEDED
are always considered non-retryable.
-
setRetryOptions
public RpcRetryOptions.Builder setRetryOptions(RpcRetryOptions o)
The parameter options takes precedence.
-
build
public RpcRetryOptions build()
Build RetryOptions without performing validation as validation should be done after merging with MethodRetry.
-
buildWithDefaultsFrom
public RpcRetryOptions buildWithDefaultsFrom(RpcRetryOptions rpcRetryOptions)
-
validateBuildWithDefaults
public RpcRetryOptions validateBuildWithDefaults()
Validates property values and builds RetryOptions with default values.
-
-