Resilience4j applies fault-tolerance patterns to synchronous service calls, helping limit downstream failures and latency so callers can protect their SLOs. section 8.2.4
Choose mechanisms according to the failure or load risk:
- Use bulkheads, rate limiters, and time limiters to constrain outstanding calls, call frequency, and wait time. section 8.2.4
- Use retries, circuit breakers, caches, and fallbacks to respond to failures; fallbacks can return default or cached data. section 8.2.4
Annotating a client proxy
In Spring Boot, Resilience4j annotations on a client proxy method let Spring AOP wrap calls with circuit-breaker, time-limiter, and retry behavior. The example supplies a fallback that returns false. section 8.2.4
Figure 8.7 A circuit breaker implements a state machine. Initially it is in the closed state, which allows requests. But if there are too many errors, it transitions to the open state, which fails requests. After a timeout period, it then transitions to a half-open state, which allows a test request to be made. If the test request succeeds, the circuit breaker transitions to the closed state, otherwise it goes back to the open state.
The diagram shows a circuit breaker moving from closed to open after repeated errors, then testing recovery in half-open state. section 8.2.4
