Class NonTransientExceptionClassesPredicate
java.lang.Object
org.axonframework.messaging.core.retry.NonTransientExceptionClassesPredicate
- Direct Known Subclasses:
AxonNonTransientExceptionClassesPredicate
A predicate for checking non-transiency of a failure comparing it against configured concrete classes.
Comparison checks if any of configured classes is assignable from a tested failure instance.
This predicate is intended to be used for configuring
RetryScheduler implementations like in the following
example:
AsyncRetryScheduler myRetryScheduler = AsyncRetryScheduler
.builder()
.retryExecutor(new ScheduledThreadPoolExecutor(1))
.nonTransientFailurePredicate(
new NonTransientExceptionClassesPredicate(
AxonNonTransientException.class, NullPointerException.class, IllegalArgumentException.class,
IllegalStateException.class
)
)
.build();
- Since:
- 4.6.0
- Author:
- Damir Murat
-
Constructor Summary
ConstructorsConstructorDescriptionNonTransientExceptionClassesPredicate(Class<? extends Throwable>... nonTransientFailures) Initialize the predicate with class(es) that are considered as non-transient. -
Method Summary
Modifier and TypeMethodDescriptionFetches a configured list of non-transient failures.protected booleanisNonTransientFailure(Throwable failure) Checks if the providedfailureis considered non-transient.boolean
-
Constructor Details
-
NonTransientExceptionClassesPredicate
@SafeVarargs public NonTransientExceptionClassesPredicate(Class<? extends Throwable>... nonTransientFailures) Initialize the predicate with class(es) that are considered as non-transient.- Parameters:
nonTransientFailures- vararg list of non-transient class(es)
-
-
Method Details
-
test
-
isNonTransientFailure
Checks if the providedfailureis considered non-transient. This implementation checks if any configured exception class is assignable to the provided failure.- Parameters:
failure- The failure to check for non-transiency- Returns:
- a boolean indicating if provided failure is non-transient (
true) or not (false)
-
getNonTransientFailures
Fetches a configured list of non-transient failures. Useful if one wants to overrideisNonTransientFailure(Throwable).- Returns:
- a configured list of non-transient failures.
-