Class FixedDelayOptions

java.lang.Object
com.azure.core.http.policy.FixedDelayOptions

public class FixedDelayOptions extends Object
The FixedDelayOptions class provides configuration options for the FixedDelay retry strategy. This strategy uses a fixed delay duration between each retry attempt.

This class is useful when you need to customize the behavior of the fixed delay retry strategy. It allows you to specify the maximum number of retry attempts and the delay duration between each attempt.

Code sample:

In this example, a FixedDelayOptions is created and used to configure a FixedDelay retry strategy. 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 between each attempt.

 FixedDelayOptions options = new FixedDelayOptions(3, Duration.ofSeconds(1));
 FixedDelay retryStrategy = new FixedDelay(options);
 
See Also:
  • Constructor Details

    • FixedDelayOptions

      public FixedDelayOptions(int maxRetries, Duration delay)
      Creates an instance of FixedDelayOptions.
      Parameters:
      maxRetries - The max number of retry attempts that can be made.
      delay - The fixed delay duration between retry attempts.
      Throws:
      IllegalArgumentException - If maxRetries is negative.
      NullPointerException - If delay is null.
  • Method Details

    • getMaxRetries

      public int getMaxRetries()
      Gets the max retry attempts that can be made.
      Returns:
      The max retry attempts that can be made.
    • getDelay

      public Duration getDelay()
      Gets the max retry attempts that can be made.
      Returns:
      The max retry attempts that can be made.