Guillaume
Guillaume

Reputation: 494

SeekToCurrentErrorHandler with RetryableException handling (and not NotRetryableException)

Actual SeekToCurrentErrorHandler has the ability to add not retryable exception, meaning all exception are retryable, except the initial one, and added X, Y, Z exceptions.

Stupid question : Is there a simple way to do the opposite : all exception are not retryable, except X', Y', Z'...

Upvotes: 0

Views: 514

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

Yes, it is possible see this configuration method of that class:

/**
 * Set an exception classifications to determine whether the exception should cause a retry
 * (until exhaustion) or not. If not, we go straight to the recoverer. By default,
 * the following exceptions will not be retried:
 * <ul>
 * <li>{@link DeserializationException}</li>
 * <li>{@link MessageConversionException}</li>
 * <li>{@link MethodArgumentResolutionException}</li>
 * <li>{@link NoSuchMethodException}</li>
 * <li>{@link ClassCastException}</li>
 * </ul>
 * All others will be retried.
 * When calling this method, the defaults will not be applied.
 * @param classifications the classifications.
 * @param defaultValue whether or not to retry non-matching exceptions.
 * @see BinaryExceptionClassifier#BinaryExceptionClassifier(Map, boolean)
 * @see #addNotRetryableExceptions(Class...)
 */
public void setClassifications(Map<Class<? extends Throwable>, Boolean> classifications, boolean defaultValue) {

So, to make everything not-retryable you need to provide a default value as false. The map should then container those exception you'd like to have retryable with the value for keys as true.

Upvotes: 3

Related Questions