In this chapter, we have seen Resilience4j and its circuit breaker and retry mechanism in action.
A circuit breaker can, using fast fail and fallback methods when it is open, prevent a microservice from becoming unresponsive if the synchronous services it depends on stop responding normally. A circuit breaker can also make a microservice resilient by allowing requests when it is half-open to see whether the failing service operates normally again and close the circuit if so.
A retry mechanism can retry requests that randomly fail from time to time, for example, due to temporary network problems. It is very important to only apply retry requests on idempotent services, that is, services that can handle that the same request is sent two or more times.
Circuit breakers and retry mechanisms are implemented by following Spring Boot conventions, that is, declaring dependencies...