Table of Contents

Class RetryInterceptor


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

public class RetryInterceptor : IInvoker
Inherited Members
Extension Methods


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.


RetryInterceptor(IInvoker, RetryOptions, ILogger)

Constructs a retry interceptor.

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


next IInvoker

The next invoker in the invocation pipeline.

options RetryOptions

The options to configure the retry interceptor.

logger ILogger

The logger.


InvokeAsync(OutgoingRequest, CancellationToken)

Sends an outgoing request and returns the corresponding incoming response.

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


request OutgoingRequest

The outgoing request being sent.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.



The corresponding IncomingResponse.


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