REQUESTS - Resiliency
Resiliency is a necessary thing to do discuss when it comes to mobile & network calls. Cell signals can drop, wifi can be spotty, and servers can be down.
The Resilience
middleware is designed to help you handle these situations. Shiny Mediator provides easy middleware to the actual
workhorse in this equation - Microsoft.Extension.Resilience. This library provides a number of resiliency patterns such as Circuit Breakers, Retry Policies, and more.
For more documentation on the Microsoft.Extension.Resilience
library, please see the official documentation
Setup
-
Install the
Shiny.Mediator.Resilience
package from NuGet -
Add the resilience middleware to your mediator setup
-
With any request handler that provides a result, you can now add the following attribute
That’s it! Your request handler is now resilient!
Configuration
We recommend configuring cache through Microsoft.Extensions.Configuration. Read Configuration for more information.
With the below configuration, you will also not need to configure resilience in your startup code.