Closed luguoji closed 3 years ago
The code is there specifically in the reactive case because we are using Project Reactor's timeout api and R4J will not handle a timeout from reactor like it would if we were using an R4J timeout.
Thanks for your reply. When I used cloud gateway, the downstream uri has runtimexception, but R4J does not CircuitBreak. I try to config the RecordExceptions,add java.lang.RuntimeException. But it still doesn't work. I hope I can get your help and support. Thanks you very much.
Currently, only TimeOutException trigger CircuitBreak, other exceptions does not work. Is it a problem?
Currently, only TimeOutException trigger CircuitBreak, other exceptions does not work. Is it a problem?
Other exceptions also can be recorded. See here io.github.resilience4j.reactor.circuitbreaker.operator.CircuitBreakerSubscriber#hookOnError
.
If you want the circuit breaker to work with the response status code, you can write a gateway filter to check the status code and throw custom exceptions. Then CircuitBreakerSubscriber#hookOnError
will catch and record the failure request.
Is the downstream service returning a specific status code when the exception is thrown?
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Currently, only TimeOutException trigger CircuitBreak, other exceptions does not work. Is it a problem?
Other exceptions also can be recorded. See here
io.github.resilience4j.reactor.circuitbreaker.operator.CircuitBreakerSubscriber#hookOnError
. If you want the circuit breaker to work with the response status code, you can write a gateway filter to check the status code and throw custom exceptions. ThenCircuitBreakerSubscriber#hookOnError
will catch and record the failure request.
Hello! I had same problem like author has, and I had follow this advice and it was very helpful for me. But now circuitbreaker's fallback method is called every time when downstream service returning http status code exception, even ciruitbreaker state is closed. Is it possible to use this way to intercept not only TimeOutException and call fallback method only when circuitbreaker is open?
Please open a separate issue and provide a sample
I am using cloud gateway circuitbreaker, find the method Mono run(Mono toRun, Function<Throwable, Mono> fallback) only handle TimeoutException, the recordexceptions of CircuitBreakerConfig does not work,such as java.lang.RuntimeException。Looks like it is bug。