Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
732 views

Using Polly v8 and RestSharp, how would I build a Generic ResiliencePipeline to account for response header retry-after, exceptions, and logging

I have an API client class built using _client = new RestSharp.RestClient(...); with methods of this form: public async Task<TResponse> PostAsync<TRequest, TResponse>(string resource, ...
Myster's user avatar
  • 18.1k
2 votes
1 answer
3k views

Leveraging AddStandardResilienceHandler and AddStandardHedgingHandler in .NET 8 for Resiliency

I have a .NET 8 API using Polly for resiliency with external services like Azure SQL and Microsoft Graph. My current implementation uses custom retry and circuit breaker policies as shown below: ...
santosh kumar patro's user avatar
1 vote
1 answer
372 views

How to migrate a standard CircruitBreaker policy from Polly V7 to V8?

Up until now, I used Polly's standard CircuitBreaker policy like this: int retryCount = 2; PolicyBuilder policyBuilder = Policy .HandleInner<WebException>() .Or<WebException>() ...
user2727133's user avatar
1 vote
1 answer
2k views

Should I implement both Retry Policy and Circuit Breaker on nested methods calling external resources?

I have a multi-layered application where Method1 calls Method2. Inside Method2, I have interactions with external resources like Redis and Event Hub. I have already implemented a Retry policy on ...
Maltion's user avatar
  • 79
2 votes
1 answer
747 views

C# Polly Start counting CircuitBreaker Exception only on the last Retry attempt Exception

I'm trying to use Polly on an HttpClient with three policies: Retry, CircuitBreaker, Timeout. The result I would like to achieve is that the CircuitBreaker always starts counting from the last error ...
pampua84's user avatar
  • 904
5 votes
3 answers
15k views

what is the difference between Circuit Breaker and Retry in spring boot microservice?

One of my colleagues asked me this question what the difference between Circuit Breaker and Retry is but I was not able answer him correctly. All I know circuit breaker is useful if there is heavy ...
Satyaprakash Nayak's user avatar
1 vote
1 answer
1k views

Polly re-try policy not working in conjunction with circuit breaker with Ocelot

I wanted to use Polly re-try and circuit breaker with Ocelot api gateway. I am trying to wrap policies with DelegatingHandler, the circuit breaker works, but re-try not works. Below code just throw ...
user584018's user avatar
  • 11.4k
1 vote
1 answer
6k views

Polly - How to achieve a circuit breaker that opens the circuit on WaitAndRetry failure and puts back retry logic on each 30 minutes if it fails

I was used to WaitAndRetryForeverAsync in the past which was wrong because I believe the Retry pattern is supposed to handle only transient faults, such as rate limiting, 429 status code, etc. At the ...
nop's user avatar
  • 6,439
-1 votes
1 answer
2k views

Polly Common interface for IAsync policies

is anyone able to tell me why this is not working? I am attempting to make a generic Interface to define a Polly RetryPolicy and CircuitBreaker policy in c# but am getting a compilation error: CS0029:...
Andrew Humphries's user avatar
6 votes
1 answer
4k views

What is the best order to apply multiple Polly policies?

The order in which Polly policies are encapsulated change the final result. Which is the best order if I want to use the following policies? This is the best order I could think of: the retries should ...
Alessandra Anyzewski's user avatar
1 vote
1 answer
1k views

WaitRetryForever is not working for a customexception in Polly.Net Resiliency

I have the following Retry and Circuit Breaker policies: var waitAndRetryPolicy = Policy .Handle<Exception>(e => e is MycustomException) .WaitAndRetryForeverAsync( attempt =&...
Yashwanth Kata's user avatar
4 votes
1 answer
7k views

Resilience4j Retry+Spring Boot 2 application.yml config not applied

I'm using Resilience4j @Retry combined with @CircuitBreaker. I use annotations in SpringBoot 2 and my configuration is in application.yml. I have a fallback method in the @Retry annotation, but not ...
Stadmina's user avatar
  • 129
0 votes
1 answer
6k views

Resilience4j.retry with exception is not working

I am using resilience4j.retry with resilience4j.circuitbreaker. Service1 is calling another service Service2, which can throw exceptions. Even if I get exceptions, I should try to connect for at least ...
roottraveller's user avatar
0 votes
1 answer
536 views

how to capture CircuitState for AsyncCircuitBreakerPolicy

I have a variable asyncPolicy of type IAsyncPolicy which has one or more policy including AsyncCircuitBreakerPolicy. Now I want to get specific policy say AsyncCircuitBreakerPolicy before a API call, ...
user584018's user avatar
  • 11.4k
1 vote
1 answer
912 views

Access to wrapped Polly policy

If I wrap some polices is it possible to acces them from the wrapped policy? example: var handle = Policy.Handle<Exception>();//.OrResult<HttpResponseMessage>(r => r....
Martin Andersen's user avatar

15 30 50 per page