311
CHAPTER 7 | Implement resilient applications
Figure 8-6. Circuit breaker returning an error to the UI
You can implement different logic for when to open/break the circuit. Or you can try an HTTP request
against a different back-
end microservice if there’s a fallback datacenter or redundant back
-end
system.
Finally, another possibility for the
CircuitBreakerPolicy
is to use
Isolate
(which forces open and
holds open the circuit) and
Reset
(which closes it again). These could be used to build a utility HTTP
endpoint that invokes Isolate and Reset directly on the policy. Such an HTTP endpoint could also be
used, suitably secured, in production for temporarily isolating a downstream system, such as when
you want to upgrade it. Or it could trip the circuit manually to protect a downstream system you
suspect to be faulting.
Dostları ilə paylaş: