Share via


RetryPolicy Class

Definition

Represents a policy that can be overriden to customize whether or not a request will be retried and how long to wait before retrying.

public class RetryPolicy : Azure.Core.Pipeline.HttpPipelinePolicy
type RetryPolicy = class
    inherit HttpPipelinePolicy
Public Class RetryPolicy
Inherits HttpPipelinePolicy
Inheritance

Constructors

RetryPolicy(Int32, DelayStrategy)

Initializes a new instance of the RetryPolicy class.

Methods

OnRequestSent(HttpMessage)

This method can be overridden to introduce logic that runs after the request is sent through the pipeline and control is returned to the retry policy. This method will only be called for sync methods.

OnRequestSentAsync(HttpMessage)

This method can be overridden to introduce logic that runs after the request is sent through the pipeline and control is returned to the retry policy. This method will only be called for async methods.

OnSendingRequest(HttpMessage)

This method can be overridden to introduce logic before each request attempt is sent. This will run even for the first attempt. This method will only be called for sync methods.

OnSendingRequestAsync(HttpMessage)

This method can be overriden to introduce logic that runs before the request is sent. This will run even for the first attempt. This method will only be called for async methods.

Process(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>)

This method can be overriden to take full control over the retry policy. If this is overriden and the base method isn't called, it is the implementer's responsibility to populate the ProcessingContext property. This method will only be called for sync methods.

ProcessAsync(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>)

This method can be overriden to take full control over the retry policy. If this is overriden and the base method isn't called, it is the implementer's responsibility to populate the ProcessingContext property. This method will only be called for async methods.

ShouldRetry(HttpMessage, Exception)

This method can be overriden to control whether a request should be retried. It will be called for any response where IsError is true, or if an exception is thrown from any subsequent pipeline policies or the transport. This method will only be called for sync methods.

ShouldRetryAsync(HttpMessage, Exception)

This method can be overriden to control whether a request should be retried. It will be called for any response where IsError is true, or if an exception is thrown from any subsequent pipeline policies or the transport. This method will only be called for async methods.

Applies to