Class RetryUtils
java.lang.Object
org.springframework.ai.retry.RetryUtils
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
FieldsModifier and TypeFieldDescriptionstatic final org.springframework.web.client.ResponseErrorHandlerDefault ResponseErrorHandler implementation.static final org.springframework.core.retry.RetryTemplateDefault RetryTemplate with exponential backoff configuration.static final org.springframework.core.retry.RetryTemplateShort RetryTemplate for testing scenarios. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
DEFAULT_RESPONSE_ERROR_HANDLER
public static final org.springframework.web.client.ResponseErrorHandler DEFAULT_RESPONSE_ERROR_HANDLERDefault ResponseErrorHandler implementation. -
DEFAULT_RETRY_TEMPLATE
public static final org.springframework.core.retry.RetryTemplate DEFAULT_RETRY_TEMPLATEDefault RetryTemplate with exponential backoff configuration. -
SHORT_RETRY_TEMPLATE
public static final org.springframework.core.retry.RetryTemplate SHORT_RETRY_TEMPLATEShort 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 operationretryable- the operation to be retried- Returns:
- the result of the retryable operation
-