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?
Asked
Active
Viewed 2,949 times
1 Answers
2
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.
srk
- 4,857
- 12
- 65
- 109
Robert Winkler
- 1,734
- 9
- 8
-
If I in fallback method will get successfully value from the cache. Does the count of errors in slide window will still increase? – Владислав Московкин Oct 05 '20 at 08:25
-
1Yes, since the fallback method is executed after the CircuitBreaker has recorded a failure. – Robert Winkler Oct 05 '20 at 12:17
-
1@RobertWinkler please help me https://stackoverflow.com/questions/68407909/using-circuit-breaker-in-spring-boot – Akash Sharma Jul 16 '21 at 12:25