From the course: .NET Microservices for Azure Developers
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Adding resilience traits to the microservice using Polly - Azure Tutorial
From the course: .NET Microservices for Azure Developers
Adding resilience traits to the microservice using Polly
- [Instructor] One of the drawbacks of synchronous communication is the potential reduction in availability as it involves multiple microservices. To address this, we can enhance resilience in our services using Polly. Polly is a .NET library designed for resilience and transient fault handling, allowing us to implement policies like automatic retry and circuit breaker. In .NET 8, we can use the Microsoft extensions Http.Resilience NuGet Package, which is based on the Polly library. So let's do that. Let's add a new NuGet package reference and the name is Microsoft.Extensions.Http.Resilience. Let's install it and let's go back to the program file and let's implement the code. Now, since we're communicating to the management microservice, this HTTP client object we're configuring here is a perfect location for implementing a resilience handler. So let's do that. I'm going to execute AddResilienceHandler, and I need to pass the name for this pipeline, say management-pipeline or…
Contents
-
-
-
-
-
-
-
(Locked)
Creating the Clinic microservice2m 44s
-
(Locked)
Adding the ClinicDbContext class3m 44s
-
(Locked)
Implementing the ManagementService class5m 41s
-
(Locked)
Implementing the ClinicApplicationService class6m 35s
-
(Locked)
Adding resilience traits to the microservice using Polly3m 20s
-
(Locked)
Creating the Container App for the Clinic microservice1m 2s
-
(Locked)
Creating the Dockerfile and modifying the workflow3m 17s
-
(Locked)
Adding environment variables to the Clinic microservice4m 41s
-
(Locked)
Challenge: Implementing a new endpoint and memory cache1m 30s
-
(Locked)
Solution: Implement a new endpoint and memory cache2m 41s
-
(Locked)
-