2 years ago

#6785

test-img

Marc Bernier

Polly Library - how to fallback to alternate domain name

I'm using the Polly along with Flurl to perform GET and POST operations to a variety of endpoints.

One of the operations that is done is a POST to ElasticSearch. We have serveral ES clusters, and what I would like to do is this:

  • Policy.TimeoutAsync to set a timeout
  • Policy.RetryAsync to retry on some failures
  • Policy.FallbackAsync to try the whole thing again pointing to a different cluster
  • Policy.CircuitBreakerAsync to stop communication attempts if all the fallbacks fail

The Timeout, Retry and CircuitBreaker policies have been set up, they work as advertised, but I cannot figure out how to make Fallback work the way I want - all the examples I see illustrate how to create a 'fake' reply rather than talk to an alternative server.

Can this be done through Polly (or Flurl)? My fallback is hand-coded looping and logic for the Fallback and CircuitBreaker policies.

c#

polly

flurl

0 Answers

Your Answer

Accepted video resources