Class HttpRetryOptions

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public abstract class HttpRetryOptions.Builder

      Builder for HttpRetryOptions.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Optional<Integer> attempts() Maximum number of attempts, including the original request.
      abstract Optional<Double> initialDelay() Initial delay before the first retry, in fractions of a second.
      abstract Optional<Double> maxDelay() Maximum delay between retries, in fractions of a second.
      abstract Optional<Double> expBase() Multiplier by which the delay increases after each attempt.
      abstract Optional<Double> jitter() Randomness factor for the delay.
      abstract Optional<List<Integer>> httpStatusCodes() List of HTTP status codes that should trigger a retry.
      static HttpRetryOptions.Builder builder() Instantiates a builder for HttpRetryOptions.
      abstract HttpRetryOptions.Builder toBuilder() Creates a builder with the same values as this instance.
      static HttpRetryOptions fromJson(String jsonString) Deserializes a JSON string to a HttpRetryOptions object.
      • Methods inherited from class com.google.genai.JsonSerializable

        fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HttpRetryOptions

        HttpRetryOptions()
    • Method Detail

      • attempts

         abstract Optional<Integer> attempts()

        Maximum number of attempts, including the original request. If 0 or 1, it means no retries. If not specified, default to 5.

      • initialDelay

         abstract Optional<Double> initialDelay()

        Initial delay before the first retry, in fractions of a second. If not specified, default to 1.0 second.

      • maxDelay

         abstract Optional<Double> maxDelay()

        Maximum delay between retries, in fractions of a second. If not specified, default to 60.0 seconds.

      • expBase

         abstract Optional<Double> expBase()

        Multiplier by which the delay increases after each attempt. If not specified, default to 2.0.

      • jitter

         abstract Optional<Double> jitter()

        Randomness factor for the delay. If not specified, default to 1.0.

      • httpStatusCodes

         abstract Optional<List<Integer>> httpStatusCodes()

        List of HTTP status codes that should trigger a retry. If not specified, a default set of retryable codes (408, 429, and 5xx) may be used.