Reputation: 1105
Is it possible to retry based on certain conditions? If I annotate with Retryable, it will retry based on some Exceptions but I want to retry if that exception is caught and the corresponding conditions is met. Example:
@Retryable(value={MyException.class},maxAttempts=2)
public myMethod(Request request){
try{
doSomething();
} Catch(Exception ex){
throw new MyException();
}
}
Here in the above request, I have a flag, isRetryRequired if that is true and MyException is caught then I want to retry
Upvotes: 9
Views: 6044
Reputation: 174554
Not directly in the annotation; you would need a custom retry policy via the interceptor
property.
Upvotes: 1