I have a class which has @Retryable annotation added to method with value as custom exception and maxAttempts =2 .
@Override
@Retryable(value = CustomException.class, maxAttempts = 2)
public void process(String input) {
//code logic
}
Currently this code is retried everytime there is a CustomException thrown in application but my code throws this CustomException in different ways like :
- throw new CustomException(CustomErrorCode.RETRY)
- throw new CustomException(CustomErrorCode.DONOTRETRY)
I want to retry CustomException which has errorcode Retry. Can anybody help?