From the course: Complete Guide to Dapr for .NET and Azure Developers: Building and Managing Microservices

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Creating and implementing circuit breaker resiliency policies

Creating and implementing circuit breaker resiliency policies

- [Instructor] Let's imagine that the hospital service is in a permanently failed state, but you still want to use the pet aggregator to retrieve pet and rescue information. If that was the case, then implementing a circuit breaker will be an effective approach. The goal of a circuit breaker is to shut off all the traffic heading to the impacted service when a certain criteria is met. So, let's implement a circuit breaker policy for the hospital microservice and update the code to handle the possibility that patient data may be known. So first, let's create the circuit breaker policy right here, circuitBreakers, that's the name of this element. And then the name of the policy, wpm-service-cb, and then interval. I'm going to use five seconds. This is the period of time that the circuit breaker is going to use to clear its internal counts. And then the following statement in the trip parameter, consecutiveFailures > 10. This is the expression that has to be true for this circuit breaker…

Contents