<PackageReference Include="System.ClientModel" Version="1.7.0" />

ClientRetryPolicy

A PipelinePolicy used by a ClientPipeline to decide whether or not to retry a PipelineRequest.
public static ClientRetryPolicy Default { get; }

The ClientRetryPolicy instance used by a default ClientPipeline.

public ClientRetryPolicy(int maxRetries = 3)

Creates a new instance of the ClientRetryPolicy class.

public ClientRetryPolicy(int maxRetries, bool enableLogging, ILoggerFactory loggerFactory)

Creates a new instance of the ClientRetryPolicy class.

protected virtual TimeSpan GetNextDelay(PipelineMessage message, int tryCount)

A method that can be overridden by derived types to customize the default ClientRetryPolicy logic. It is called from Process to determine how long the policy should wait before re-sending the request.

protected virtual void OnRequestSent(PipelineMessage message)

A method that can be overridden by derived types to extend the default ClientRetryPolicy logic. It is called from Process just after control has been returned from the policy at the position after the retry policy in the pipeline.

protected virtual ValueTask OnRequestSentAsync(PipelineMessage message)

A method that can be overridden by derived types to extend the default ClientRetryPolicy logic. It is called from Process just after control has been returned from the policy at the position after the retry policy in the pipeline.

protected virtual void OnSendingRequest(PipelineMessage message)

A method that can be overridden by derived types to extend the default ClientRetryPolicy logic. It is called from Process prior to passing control to the next policy in the pipeline.

protected virtual ValueTask OnSendingRequestAsync(PipelineMessage message)

A method that can be overridden by derived types to extend the default ClientRetryPolicy logic. It is called from Process prior to passing control to the next policy in the pipeline.

protected virtual void OnTryComplete(PipelineMessage message)

A method that can be overridden by derived types to extend the default ClientRetryPolicy logic. It is called from Process after the time interval for the current retry attempt has passed.

protected virtual bool ShouldRetry(PipelineMessage message, Exception exception)

A method that can be overridden by derived types to customize the default ClientRetryPolicy logic. It is called from Process after control has been returned from the policy at the position after the retry policy in the pipeline.

protected virtual ValueTask<bool> ShouldRetryAsync(PipelineMessage message, Exception exception)

A method that can be overridden by derived types to customize the default ClientRetryPolicy logic. It is called from Process after control has been returned from the policy at the position after the retry policy in the pipeline.

protected virtual void Wait(TimeSpan time, CancellationToken cancellationToken)

A method that can be overridden by derived types to customize the default ClientRetryPolicy logic. It is called from Process to wait the time interval returned by GetNextDelay.

protected virtual Task WaitAsync(TimeSpan time, CancellationToken cancellationToken)

A method that can be overridden by derived types to customize the default ClientRetryPolicy logic. It is called from Process to wait the time interval returned by GetNextDelay.