Spring Boot Resilience4J Circuit Breaker(fallback method)

3.4k views Asked by At

I don't have clearly understand how the fallback method works. For example: Example Will this method be executed after each error in the callee method or just when the circuit breaker will be closed?

1

There are 1 answers

3
Robert Winkler On

It's like a try/catch, but after the CircuitBreaker has recorded success/failure. If you use Exception in your fallback method signature, it catches all Exceptions. But you can narrow down the scope to CallNotPermittedException, if you only want to execute the fallback method when the CircuitBreaker is open.