Spring / Resilience4j Interview questions
What are the states of a CircuitBreaker?
A Resilience4j CircuitBreaker moves through several distinct states rather than just "on" or "off".
- CLOSED - calls pass through normally and results feed the failure-rate calculation.
- OPEN - calls are rejected immediately without touching the dependency.
- HALF_OPEN - a limited number of trial calls are permitted to test recovery.
- DISABLED - the breaker is switched off and always allows calls through.
- FORCED_OPEN - the breaker is manually forced to reject every call.
- METRICS_ONLY - calls are always permitted but metrics are still recorded, useful for observing behavior before enforcing it.
State transitions:
stateDiagram-v2 [*] --> CLOSED CLOSED --> OPEN: failure rate exceeded OPEN --> HALF_OPEN: wait duration elapses HALF_OPEN --> CLOSED: trial calls succeed HALF_OPEN --> OPEN: trial calls fail CLOSED --> FORCED_OPEN: manual override CLOSED --> DISABLED: manual override
More Related questions...