A circuit breaker is a stateful proxy that sits between a caller and a dependency. It monitors calls to the dependency and transitions between three states based on observed failure rates:
| State | Behaviour | Transition out |
|---|---|---|
| CLOSED | Requests pass through normally | N consecutive failures → OPEN |
| OPEN | All requests are rejected immediately (fast-fail) | After timeout period → HALF-OPEN |
| HALF-OPEN | One probe request passes through | Success → CLOSED; Failure → OPEN |
The circuit breaker does not fix the failing dependency. It protects the caller from being blocked by the dependency’s failure. When the dependency recovers, the circuit breaker detects recovery via the HALF-OPEN probe and restores normal operation.