Class RetryUtils

java.lang.Object
org.springframework.ai.retry.RetryUtils

public abstract class RetryUtils extends Object
RetryUtils is a utility class for configuring and handling retry operations. It provides a default RetryTemplate and a default ResponseErrorHandler.
Since:
0.8.1
Author:
Christian Tzolov, Soby Chacko
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.springframework.web.client.ResponseErrorHandler
    Default ResponseErrorHandler implementation.
    static final org.springframework.core.retry.RetryTemplate
    Default RetryTemplate with exponential backoff configuration.
    static final org.springframework.core.retry.RetryTemplate
    Short RetryTemplate for testing scenarios.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <R extends @Nullable Object>
    R
    execute(org.springframework.core.retry.RetryTemplate retryTemplate, org.springframework.core.retry.Retryable<R> retryable)
    Generic execute method to run retryable operations with the provided RetryTemplate.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_RESPONSE_ERROR_HANDLER

      public static final org.springframework.web.client.ResponseErrorHandler DEFAULT_RESPONSE_ERROR_HANDLER
      Default ResponseErrorHandler implementation.
    • DEFAULT_RETRY_TEMPLATE

      public static final org.springframework.core.retry.RetryTemplate DEFAULT_RETRY_TEMPLATE
      Default RetryTemplate with exponential backoff configuration.
    • SHORT_RETRY_TEMPLATE

      public static final org.springframework.core.retry.RetryTemplate SHORT_RETRY_TEMPLATE
      Short RetryTemplate for testing scenarios.
  • Constructor Details

    • RetryUtils

      public RetryUtils()
  • Method Details

    • execute

      public static <R extends @Nullable Object> R execute(org.springframework.core.retry.RetryTemplate retryTemplate, org.springframework.core.retry.Retryable<R> retryable)
      Generic execute method to run retryable operations with the provided RetryTemplate.
      Type Parameters:
      R - the return type
      Parameters:
      retryTemplate - the RetryTemplate to use for executing the retryable operation
      retryable - the operation to be retried
      Returns:
      the result of the retryable operation