Class DefaultRetryHandler
- java.lang.Object
-
- com.rabbitmq.client.impl.recovery.DefaultRetryHandler
-
- All Implemented Interfaces:
RetryHandler
public class DefaultRetryHandler extends Object implements RetryHandler
Composable topology recovery retry handler. This retry handler implementations let the user choose the condition to trigger retry and the retry operation for each type of recoverable entities. The number of attempts and the backoff policy (time to wait between retries) are also configurable.See also
TopologyRecoveryRetryHandlerBuilderto easily create instances andTopologyRecoveryRetryLogicfor ready-to-use conditions and operations.- Since:
- 4.8.0
- See Also:
TopologyRecoveryRetryHandlerBuilder,TopologyRecoveryRetryLogic
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultRetryHandler.RetryCondition<E extends RecordedEntity>static classDefaultRetryHandler.RetryOperation<T>
-
Constructor Summary
Constructors Constructor Description DefaultRetryHandler(DefaultRetryHandler.RetryCondition<? super RecordedQueue> queueRecoveryRetryCondition, DefaultRetryHandler.RetryCondition<? super RecordedExchange> exchangeRecoveryRetryCondition, DefaultRetryHandler.RetryCondition<? super RecordedBinding> bindingRecoveryRetryCondition, DefaultRetryHandler.RetryCondition<? super RecordedConsumer> consumerRecoveryRetryCondition, DefaultRetryHandler.RetryOperation<?> queueRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> exchangeRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> bindingRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> consumerRecoveryRetryOperation, int retryAttempts, BackoffPolicy backoffPolicy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T extends RecordedEntity>
RetryResultdoRetry(DefaultRetryHandler.RetryCondition<T> condition, DefaultRetryHandler.RetryOperation<?> operation, T entity, RetryContext context)protected voidlog(RecordedEntity entity, Exception exception, int attempts)RetryResultretryBindingRecovery(RetryContext context)Retry a failed binding recovery operation.RetryResultretryConsumerRecovery(RetryContext context)Retry a failed consumer recovery operation.RetryResultretryExchangeRecovery(RetryContext context)Retry a failed exchange recovery operation.RetryResultretryQueueRecovery(RetryContext context)Retry a failed queue recovery operation.
-
-
-
Constructor Detail
-
DefaultRetryHandler
public DefaultRetryHandler(DefaultRetryHandler.RetryCondition<? super RecordedQueue> queueRecoveryRetryCondition, DefaultRetryHandler.RetryCondition<? super RecordedExchange> exchangeRecoveryRetryCondition, DefaultRetryHandler.RetryCondition<? super RecordedBinding> bindingRecoveryRetryCondition, DefaultRetryHandler.RetryCondition<? super RecordedConsumer> consumerRecoveryRetryCondition, DefaultRetryHandler.RetryOperation<?> queueRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> exchangeRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> bindingRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> consumerRecoveryRetryOperation, int retryAttempts, BackoffPolicy backoffPolicy)
-
-
Method Detail
-
retryQueueRecovery
public RetryResult retryQueueRecovery(RetryContext context) throws Exception
Description copied from interface:RetryHandlerRetry a failed queue recovery operation.- Specified by:
retryQueueRecoveryin interfaceRetryHandler- Parameters:
context- the context of the retry- Returns:
- the result of the retry attempt
- Throws:
Exception- if the retry fails
-
retryExchangeRecovery
public RetryResult retryExchangeRecovery(RetryContext context) throws Exception
Description copied from interface:RetryHandlerRetry a failed exchange recovery operation.- Specified by:
retryExchangeRecoveryin interfaceRetryHandler- Parameters:
context- the context of the retry- Returns:
- the result of the retry attempt
- Throws:
Exception- if the retry fails
-
retryBindingRecovery
public RetryResult retryBindingRecovery(RetryContext context) throws Exception
Description copied from interface:RetryHandlerRetry a failed binding recovery operation.- Specified by:
retryBindingRecoveryin interfaceRetryHandler- Parameters:
context- the context of the retry- Returns:
- the result of the retry attempt
- Throws:
Exception- if the retry fails
-
retryConsumerRecovery
public RetryResult retryConsumerRecovery(RetryContext context) throws Exception
Description copied from interface:RetryHandlerRetry a failed consumer recovery operation.- Specified by:
retryConsumerRecoveryin interfaceRetryHandler- Parameters:
context- the context of the retry- Returns:
- the result of the retry attempt
- Throws:
Exception- if the retry fails
-
doRetry
protected <T extends RecordedEntity> RetryResult doRetry(DefaultRetryHandler.RetryCondition<T> condition, DefaultRetryHandler.RetryOperation<?> operation, T entity, RetryContext context) throws Exception
- Throws:
Exception
-
log
protected void log(RecordedEntity entity, Exception exception, int attempts)
-
-