spring-retry
spring-retry copied to clipboard
Rework Exception-wrapping
Currently, @CircuitBreaker
always wraps failures into into an ExhaustedRetryException
. This hides the true nature of the failure and makes it furthermore impossible to figure out whether the circuit breaker is actually open or not.
Having e.g. a @Recover
-method just to unwrap and rethrow exceptions seems not a proper way to go... it also doesn't solve the circuit breaker status issue.
The only currently available alternative is to implement a custom circuit breaker RetryTemplate
which feels odd.
Please fix.
It's not really a @CircuitBreaker
feature is it (the RetryTemplate
always wraps the last failed exception)?
It has been like that since the beginning, and therefore there might be reasons and also people relying on the behaviour, so "please fix" is kind of irresponsible. If you have a concrete suggestion about how to evolve the code please feel free to comment or send patches.
@dsyer
Hi, dsyer
About the issue, I make a pull request #133 .
I add an option on the @Retryable
to decide whether the original exception will be thrown .
Please review, thanks!