Class RetryingRpcClient
java.lang.Object
com.linecorp.armeria.common.util.AbstractUnwrappable<Client<T_I,T_O>>
com.linecorp.armeria.client.DecoratingClient<I,O,I,O>
com.linecorp.armeria.client.SimpleDecoratingClient<I,O>
com.linecorp.armeria.client.retry.AbstractRetryingClient<RpcRequest,RpcResponse>
com.linecorp.armeria.client.retry.RetryingRpcClient
- All Implemented Interfaces:
Client<RpcRequest,RpcResponse>
,RpcClient
,Unwrappable
public final class RetryingRpcClient
extends AbstractRetryingClient<RpcRequest,RpcResponse>
implements RpcClient
An
RpcClient
decorator that handles failures of an invocation and retries RPC requests.-
Field Summary
Fields inherited from class com.linecorp.armeria.client.retry.AbstractRetryingClient
ARMERIA_RETRY_COUNT
-
Method Summary
Modifier and TypeMethodDescriptionstatic RetryingRpcClientBuilder
builder(RetryConfig<RpcResponse> retryConfig)
Returns a newRetryingRpcClientBuilder
with the specifiedRetryConfig
.static RetryingRpcClientBuilder
builder(RetryConfigMapping<RpcResponse> mapping)
Returns a newRetryingRpcClientBuilder
with the specifiedRetryConfigMapping
.static RetryingRpcClientBuilder
builder(RetryRuleWithContent<RpcResponse> retryRuleWithContent)
Returns a newRetryingRpcClientBuilder
with the specifiedRetryRuleWithContent
.protected RpcResponse
doExecute(ClientRequestContext ctx, RpcRequest req)
Invoked byAbstractRetryingClient.execute(ClientRequestContext, Request)
after the deadline for response timeout is set.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryConfig<RpcResponse> retryConfig)
Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryConfigMapping<RpcResponse> mapping)
Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent)
Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent, int maxTotalAttempts)
Deprecated.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent, int maxTotalAttempts, long responseTimeoutMillisForEachAttempt)
Deprecated.UsenewDecorator(RetryConfig)
instead.Methods inherited from class com.linecorp.armeria.client.retry.AbstractRetryingClient
execute, getNextDelay, getNextDelay, getTotalAttempts, mapping, newDerivedContext, onRetryingComplete, retryRule, retryRuleWithContent, scheduleNextRetry, setResponseTimeout
Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap
-
Method Details
-
newDecorator
public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent)Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
retryRuleWithContent
- the retry rule
-
newDecorator
@Deprecated public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent, int maxTotalAttempts)Deprecated.UsenewDecorator(RetryConfig)
instead.Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
retryRuleWithContent
- the retry rulemaxTotalAttempts
- the maximum number of total attempts
-
newDecorator
@Deprecated public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent, int maxTotalAttempts, long responseTimeoutMillisForEachAttempt)Deprecated.UsenewDecorator(RetryConfig)
instead.Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
retryRuleWithContent
- the retry rulemaxTotalAttempts
- the maximum number of total attemptsresponseTimeoutMillisForEachAttempt
- response timeout for each attempt.0
disables the timeout
-
newDecorator
public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryConfig<RpcResponse> retryConfig)Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests. TheRetryConfig
object encapsulatesRetryRuleWithContent
,maxContentLength
,maxTotalAttempts
andresponseTimeoutMillisForEachAttempt
. -
newDecorator
public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryConfigMapping<RpcResponse> mapping)Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
mapping
- the mapping that returns aRetryConfig
for a givenClientRequestContext
andRequest
.
-
builder
public static RetryingRpcClientBuilder builder(RetryRuleWithContent<RpcResponse> retryRuleWithContent)Returns a newRetryingRpcClientBuilder
with the specifiedRetryRuleWithContent
. -
builder
Returns a newRetryingRpcClientBuilder
with the specifiedRetryConfig
. TheRetryConfig
encapsulatesRetryRuleWithContent
,maxContentLength
,maxTotalAttempts
andresponseTimeoutMillisForEachAttempt
. -
builder
Returns a newRetryingRpcClientBuilder
with the specifiedRetryConfigMapping
. -
doExecute
Description copied from class:AbstractRetryingClient
Invoked byAbstractRetryingClient.execute(ClientRequestContext, Request)
after the deadline for response timeout is set.- Specified by:
doExecute
in classAbstractRetryingClient<RpcRequest,RpcResponse>
- Throws:
Exception
-
newDecorator(RetryConfig)
instead.