Class SpringRetryTemplateAdapter
java.lang.Object
org.springframework.core.retry.RetryTemplate
org.springframework.amqp.rabbit.retry.SpringRetryTemplateAdapter
- All Implemented Interfaces:
org.springframework.core.retry.RetryOperations
public class SpringRetryTemplateAdapter
extends org.springframework.core.retry.RetryTemplate
The
RetryTemplate adapter for
the RetryTemplate instance.
The goal of this class is to simplify a migration path for existing retry infrastructure.
The super RetryTemplate is configured with "no retry" policy
since all the retrying logic is delegated to the provided
RetryTemplate.
NOTE: only stateless operations are delegated with implementation at the moment.
- Author:
- Artem Bilan
-
Constructor Summary
ConstructorsConstructorDescriptionSpringRetryTemplateAdapter(org.springframework.retry.support.RetryTemplate retryTemplate) -
Method Summary
Modifier and TypeMethodDescription<R> @Nullable Rexecute(org.springframework.core.retry.Retryable<? extends @Nullable R> retryable) voidsetRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback) Set aRecoveryCallbackto be used in theRetryTemplate.execute(RetryCallback, RecoveryCallback)delegating operation.voidsetRetryPolicy(org.springframework.core.retry.RetryPolicy retryPolicy) Methods inherited from class org.springframework.core.retry.RetryTemplate
setRetryListener
-
Constructor Details
-
SpringRetryTemplateAdapter
public SpringRetryTemplateAdapter(org.springframework.retry.support.RetryTemplate retryTemplate)
-
-
Method Details
-
setRetryPolicy
public void setRetryPolicy(org.springframework.core.retry.RetryPolicy retryPolicy) - Overrides:
setRetryPolicyin classorg.springframework.core.retry.RetryTemplate
-
setRecoveryCallback
public void setRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback) Set aRecoveryCallbackto be used in theRetryTemplate.execute(RetryCallback, RecoveryCallback)delegating operation. This is exactly aRecoveryCallbackused previously in the target service alongside with aRetryTemplate.- Parameters:
recoveryCallback- theRecoveryCallbackto use.
-
execute
public <R> @Nullable R execute(org.springframework.core.retry.Retryable<? extends @Nullable R> retryable) throws org.springframework.core.retry.RetryException - Specified by:
executein interfaceorg.springframework.core.retry.RetryOperations- Overrides:
executein classorg.springframework.core.retry.RetryTemplate- Throws:
org.springframework.core.retry.RetryException
-