Spring / Resilience4j Interview questions
What is a Circuit Breaker in Resilience4j?
A CircuitBreaker wraps a call to a potentially failing dependency and stops sending traffic to it once failures cross a configured threshold, instead of letting every caller keep waiting on a service that's already struggling.
It works like an electrical circuit breaker: normal traffic flows through in the CLOSED state, but once too many recent calls fail or run slow, it flips to OPEN and rejects calls immediately with a CallNotPermittedException, giving the dependency time to recover.
After a wait period it moves to HALF_OPEN and allows a small number of trial calls through to test whether the dependency has recovered, before deciding whether to close again or reopen.
More Related questions...