Error response returned by the server is ignored by resilience4j
See original GitHub issueHi
I am using the resilience4j with Feign client for communication with another server (lets say it is running on localhost:8090 with 1 exposed endpoint i.e. /sample). I am testing a case when I want to record only specific exceptions from the underlying http client library. So following is my config:
resilience4j.circuitbreaker:
configs:
default:
registerHealthIndicator: true
ringBufferSizeInClosedState: 4
ringBufferSizeInHalfOpenState: 2
automaticTransitionFromOpenToHalfOpenEnabled: true
waitDurationInOpenState: 20s
failureRateThreshold: 50
eventConsumerBufferSize: 10
ignoreExceptions:
- com.resilience4j.exception.BusinessException
recordExceptions:
- java.net.SocketTimeoutException
- feign.RetryableException
Now when the /sample endpoint returns a response with http status 400, which is a valid case and due to incorrect data passed. The /sample endpoint returns the following response if called separately
{
"message": "this is a bad request"
}
But the resilience4j library ignores this response and returns the following response:
{
"timestamp": "2019-08-14T09:40:00.568+0000",
"status": 500,
"error": "Internal Server Error",
"message": "status 400 reading MyFeignClient#feignMessage()",
"path": "/resilience4j/feignClient"
}
How can I preserve the original response returned by the other server?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to Prevent Certain Exceptions from Tripping a ...
The Resilience4j circuit breaker by default considers any exception thrown inside of the Supplier as a failure. If over 50% of the calls...
Read more >Failover and Circuit Breaker with Resilience4j | by Rob Golder
In this demo application, if the secondary 3PP lookup fails, then that exception will be returned to the client of this service. It...
Read more >NoSuchMethodException in resilience4j fallback with spring ...
I tried to implement this technology with eureka server but get stuck at this fallback method point. my pom.xml <?xml version="1.0" encoding=" ...
Read more >CircuitBreaker - resilience4j
The Predicate must return true if the exception should be ignored. The Predicate must return false, if the exception should count as a...
Read more >Implementing Retry with Resilience4j - Reflectoring
We have two options when a remote operation fails - immediately return an error to our client, or retry the operation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
recordExceptions
: Configures a list of classes that are recorded as a failure and thus increase the failure rate. Any exception matching or inheriting from one of the list should count as a failure, unless ignored viaignoreExceptions
. All other exceptions are not recorded, which means that they are ignored and thus do not count as success nor failure. If you add an exception torecordExceptions
it’s like: ignore all exceptions except this one. If you add an exception toignoreExceptions
it’s like: record all exceptions except this one.The combination of ignoreExceptions and recordExceptions is helpful when you want to handle inheritance. For example:
ignoreExceptions(Exception.class)
andrecordExceptions(Throwable.class)
would recordjava.lang.Error
as a failure.Closed in favor of #568