Table of Contents

Class RetryInterceptor

Namespace
IceRpc.Retry
Assembly
IceRpc.Retry.dll

The retry interceptor is responsible for retrying failed requests when the failure condition can be retried.

public class RetryInterceptor : IInvoker
Inheritance
RetryInterceptor
Implements
Inherited Members
Extension Methods

Remarks

A failed request can be retried if:

  • MaxAttempts is not reached.
  • Payload can be read again.
  • The failure condition can be retried.

In order to be able to read again the request's payload, the retry interceptor decorates the payload with ResettablePipeReaderDecorator. The decorator can be reset as long as the buffered data doesn't exceed MaxPayloadSize.

The request can be retried under the following failure conditions:

If the status code carried by the response is Unavailable or NotFound (with the ice protocol), the address of the server is removed from the set of server addresses to retry on. This ensures the request won't be retried on the unavailable server.

Constructors

RetryInterceptor(IInvoker, RetryOptions, ILogger)

Constructs a retry interceptor.

public RetryInterceptor(IInvoker next, RetryOptions options, ILogger logger)

Parameters

next IInvoker

The next invoker in the invocation pipeline.

options RetryOptions

The options to configure the retry interceptor.

logger ILogger

The logger.

Methods

InvokeAsync(OutgoingRequest, CancellationToken)

Sends an outgoing request and returns the corresponding incoming response.

public Task<IncomingResponse> InvokeAsync(OutgoingRequest request, CancellationToken cancellationToken)

Parameters

request OutgoingRequest

The outgoing request being sent.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

Task<IncomingResponse>

The corresponding IncomingResponse.

Remarks

When request is a two-way request, the returned task will not complete successfully until after the request's Payload is fully sent and the response is received from the peer. When the request is a one-way request, the returned task completes successfully with an empty response when the request's Payload is fully sent. For all requests (one-way and two-way), the sending of the request's PayloadContinuation can continue in a background task after the returned task has completed successfully.

See Also