April 2018
Intermediate to advanced
300 pages
7h 41m
English
Polly also provides a fallback policy that returns some default responses if the service is failing. It can be used in conjunction with both the retry and circuit breaker policies. The basic idea behind fallback is to send a default response to the consumer rather than returning the actual error in the response. The response should give some meaningful information to the user that is specific to the application's nature. This is very beneficial when your services are used by external consumers of applications.
We can modify the preceding example and add fallback policies for both the retry and circuit breaker exceptions. In the ResilientHttpClient class, we will add these two variables:
static ...