Closed VravikumarV closed 4 years ago
The fallback is like a try/catch. It catches every exception which you have specified in your method signature.
It does not ignore any exceptions right now.
If you only want to have fallback methods for certain exceptions, define fallback methods with specific exceptions.
Also better wrap exceptions in a custom ValidationException
.
public MyExpectedResponse getMyExpectedResponseFallBack(final String custId, NumberFormatException ex) {
}
public MyExpectedResponse getMyExpectedResponseFallBack(final String custId, NullPointerException ex) {
}
public MyExpectedResponse getMyExpectedResponseFallBack(final String custId, CallNotPermittedException ex) {
}
better is:
public MyExpectedResponse getMyExpectedResponseFallBack(final String custId, ValidationException ex) {
}
public MyExpectedResponse getMyExpectedResponseFallBack(final String custId, CallNotPermittedException ex ) {
}
Resilience4j version:
Java version: 11
Spring Rest Controller methods are configured as follows:
application.yml
Based on the above code base, am expecting that CircuitBreaker fallback should be triggered and response should return from fallback method only for all exception mentioned as recordExceptions (in this case NullPointerException for custId = 11130423).
But in my case, fallBackmethod getting triggered for exceptions declared under ignoreExceptions as well (in this case NumberFormatException for a given input custId = 11130817)
Could you help on this to on how to consider only recordExceptions (in this case: NullPointerException) for fallBack behaviour but not ignoreExceptions (in this case : NumberFormatException) configuration ?
Thanks for raising a Resilience4j issue. Please replace this text with a brief description of your problem along with the versions you are using. If possible, please also consider putting together a complete JUnit test that reproduces the issue.