Spring / Resilience4j Interview questions
What happens when a CircuitBreaker transitions to OPEN?
The moment the failure or slow-call rate crosses its threshold, the breaker immediately switches to OPEN and every subsequent call is rejected with a CallNotPermittedException instead of being attempted against the dependency at all.
Any fallback method configured alongside the CircuitBreaker still runs, since the fallback is triggered by the exception the caller receives regardless of whether that exception came from an actual failed call or from the breaker rejecting the call outright.
Internally, a StateTransition event fires that any registered event listener can observe - useful for logging or alerting the moment a dependency is declared unhealthy - and a timer starts counting down waitDurationInOpenState before the breaker is eligible to try HALF_OPEN.
More Related questions...