Class DefaultRetryHandler
java.lang.Object
com.rabbitmq.client.impl.recovery.DefaultRetryHandler
- All Implemented Interfaces:
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 TopologyRecoveryRetryHandlerBuilder
to easily create
instances and TopologyRecoveryRetryLogic
for ready-to-use
conditions and operations.
- Since:
- 5.4.0
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected final BackoffPolicy
protected final BiPredicate
<? super RecordedBinding, Exception> protected final DefaultRetryHandler.RetryOperation
<?> protected final BiPredicate
<? super RecordedConsumer, Exception> protected final DefaultRetryHandler.RetryOperation
<?> protected final BiPredicate
<? super RecordedExchange, Exception> protected final DefaultRetryHandler.RetryOperation
<?> protected final BiPredicate
<? super RecordedQueue, Exception> protected final DefaultRetryHandler.RetryOperation
<?> protected final int
-
Constructor Summary
ConstructorDescriptionDefaultRetryHandler
(BiPredicate<? super RecordedQueue, Exception> queueRecoveryRetryCondition, BiPredicate<? super RecordedExchange, Exception> exchangeRecoveryRetryCondition, BiPredicate<? super RecordedBinding, Exception> bindingRecoveryRetryCondition, BiPredicate<? super RecordedConsumer, Exception> consumerRecoveryRetryCondition, DefaultRetryHandler.RetryOperation<?> queueRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> exchangeRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> bindingRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> consumerRecoveryRetryOperation, int retryAttempts, BackoffPolicy backoffPolicy) -
Method Summary
Modifier and TypeMethodDescriptionprotected RetryResult
doRetry
(BiPredicate<RecordedEntity, Exception> condition, DefaultRetryHandler.RetryOperation<?> operation, RecordedEntity entity, RetryContext context) protected void
log
(RecordedEntity entity, Exception exception, int attempts) retryBindingRecovery
(RetryContext context) Retry a failed binding recovery operation.retryConsumerRecovery
(RetryContext context) Retry a failed consumer recovery operation.retryExchangeRecovery
(RetryContext context) Retry a failed exchange recovery operation.retryQueueRecovery
(RetryContext context) Retry a failed queue recovery operation.
-
Field Details
-
queueRecoveryRetryCondition
-
exchangeRecoveryRetryCondition
-
bindingRecoveryRetryCondition
-
consumerRecoveryRetryCondition
-
queueRecoveryRetryOperation
-
exchangeRecoveryRetryOperation
-
bindingRecoveryRetryOperation
-
consumerRecoveryRetryOperation
-
retryAttempts
protected final int retryAttempts -
backoffPolicy
-
-
Constructor Details
-
DefaultRetryHandler
public DefaultRetryHandler(BiPredicate<? super RecordedQueue, Exception> queueRecoveryRetryCondition, BiPredicate<? super RecordedExchange, Exception> exchangeRecoveryRetryCondition, BiPredicate<? super RecordedBinding, Exception> bindingRecoveryRetryCondition, BiPredicate<? super RecordedConsumer, Exception> consumerRecoveryRetryCondition, DefaultRetryHandler.RetryOperation<?> queueRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> exchangeRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> bindingRecoveryRetryOperation, DefaultRetryHandler.RetryOperation<?> consumerRecoveryRetryOperation, int retryAttempts, BackoffPolicy backoffPolicy)
-
-
Method Details
-
retryQueueRecovery
Description copied from interface:RetryHandler
Retry a failed queue recovery operation.- Specified by:
retryQueueRecovery
in interfaceRetryHandler
- Parameters:
context
- the context of the retry- Returns:
- the result of the retry attempt
- Throws:
Exception
- if the retry fails
-
retryExchangeRecovery
Description copied from interface:RetryHandler
Retry a failed exchange recovery operation.- Specified by:
retryExchangeRecovery
in interfaceRetryHandler
- Parameters:
context
- the context of the retry- Returns:
- the result of the retry attempt
- Throws:
Exception
- if the retry fails
-
retryBindingRecovery
Description copied from interface:RetryHandler
Retry a failed binding recovery operation.- Specified by:
retryBindingRecovery
in interfaceRetryHandler
- Parameters:
context
- the context of the retry- Returns:
- the result of the retry attempt
- Throws:
Exception
- if the retry fails
-
retryConsumerRecovery
Description copied from interface:RetryHandler
Retry a failed consumer recovery operation.- Specified by:
retryConsumerRecovery
in interfaceRetryHandler
- Parameters:
context
- the context of the retry- Returns:
- the result of the retry attempt
- Throws:
Exception
- if the retry fails
-
doRetry
protected RetryResult doRetry(BiPredicate<RecordedEntity, Exception> condition, DefaultRetryHandler.RetryOperation<?> operation, RecordedEntity entity, RetryContext context) throws Exception- Throws:
Exception
-
log
-