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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BackoffPolicyprotected 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
ConstructorsConstructorDescriptionDefaultRetryHandler(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 RetryResultdoRetry(BiPredicate<RecordedEntity, Exception> condition, DefaultRetryHandler.RetryOperation<?> operation, RecordedEntity entity, RetryContext context) protected voidlog(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: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
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
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
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 RetryResult doRetry(BiPredicate<RecordedEntity, Exception> condition, DefaultRetryHandler.RetryOperation<?> operation, RecordedEntity entity, RetryContext context) throws Exception- Throws:
Exception
-
log
-