If our backend service is experiencing slowness or if the service is down for any reason, the circuit breaker receives a failure response for a backend service. Once the number of failure requests increases by a predefined threshold value, it will change the circuit breaker state to open. The circuit breaker can handle this situation by serving a cached page or a timeout page and help those services recover by reducing their load:
As we can see from the preceding diagram, our backend microservice (Supplier Microservice) is unavailable. The Circuit Breaker responds with either an Error or a cached page to the Client. We can add in logic to our Circuit Breaker to indicate which response it should send if the backend microservice is unavailable.