Class FixedDelay

java.lang.Object
com.azure.core.http.policy.FixedDelay
All Implemented Interfaces:
RetryStrategy

public class FixedDelay extends Object implements RetryStrategy
The FixedDelay class is an implementation of the RetryStrategy interface. This strategy uses a fixed delay duration between each retry attempt.

This class is useful when you need to handle retries for operations that may transiently fail. It ensures that the retries are performed with a fixed delay to provide a consistent delay between retries.

Code sample:

In this example, a FixedDelay is created with a maximum of 3 retry attempts and a delay of 1 second between each attempt. The strategy is then used in a RetryPolicy which can then be added to the pipeline. For a request then sent by the pipeline, if the server responds with a transient error, the request will be retried with a fixed delay of 1 second between each attempt.

 FixedDelay retryStrategy = new FixedDelay(3, Duration.ofSeconds(1));
 RetryPolicy policy = new RetryPolicy(retryStrategy);
 
See Also: