Questions tagged [retry-logic]

Programming techniques designed to retry operations that failed due to error codes, exceptions, or other language specific means.

377 questions
3
votes
1 answer

Polly: BulkheadPolicy combined with RetryPolicy

I've got a C# API that communications with a web service that throws exceptions if it's too busy. I want to limit the number of parallel calls to this WCF service. As the web service quickly throws exceptions when it's too busy, I want to use a…
Boland
  • 1,531
  • 1
  • 14
  • 42
3
votes
1 answer

How to retry blocking IO Action when timeout?

How does one deal with a blocking IO action in Haskell? How can I put this IO action inside a scope and manage this scope from another method? If the timeout is reached, I would just reinvoke this method. Normally in other languages, I would…
Bercovici Adrian
  • 8,794
  • 17
  • 73
  • 152
3
votes
1 answer

How to implement exponential backoff/delay calculation with fixed timeout and number of attempts?

Most backoff/delay algorithms I've seen have fixed number of attempts OR fixed timeout, but not both. I want to make exactly M attempts within T seconds, with exponential spacing between them, so that "T = delay(0) + delay(1) + ... + delay(M-1)",…
3
votes
1 answer

How to combine Redelivery policy and Hystrix circuit breaker in Apache Camel?

I would like to implement Apache Camel route with retry and Hystrix circuit breaker. My route looks like this: ...... java.lang.Exception
Anton Krosnev
  • 3,964
  • 1
  • 21
  • 37
3
votes
1 answer

Retry logic for Azure EventHub PartitionedSender

I am sending / recieving data from an Azure Event Hub. As I have a requirement messages must be processed in sequence by the consumer, I have decided to go with a PartitionSender and always send events to the same partition. Under "Consistency" in…
David Andersson
  • 55
  • 1
  • 1
  • 6
2
votes
1 answer

C# Polly combining http error handler, retry, bulkhead and timeout to be used inside HttpClient

I am trying to make some HTTP calls and I want to have retry, timeout, and bulkhead for maximum concurrent connections. This is my attempt. I don't know if the order of the WrapAsync function calls is correct. More specifically, I may sometimes get…
Node.JS
  • 1,042
  • 6
  • 44
  • 114
2
votes
2 answers

How to filter specific endpoint for retry policy using Polly

How to filter specific endpoint for retry policy using Polly All client requests MyServiceHttpClient will retry. How disable retry policy specific api? services.AddHttpClient(client => { /* configuration…
Rafael
  • 35
  • 5
2
votes
1 answer

[Junit-pioneer]How to add RetryingTest for all test methods?

I'd like to use @RetryingTest(3) for all my test methods, is there a easy way to apply it for all test methods instead of add @RetryingTest(3) for test method one by one? Or if there is a global way to enable retry for all test methods? Walkthough…
Jason
  • 1,241
  • 8
  • 16
2
votes
2 answers

Catching Internal Sealed Exceptions

Using the ConfigurePrimaryHttpMessageHandler / AddPolicyHandler retry pattern how can you perform a retry for an exception that you can't reference because of internal sealed? Ideally I'd like to do this: .AddPolicyHandler(HttpPolicyExtensions …
Steji
  • 580
  • 1
  • 6
  • 17
2
votes
1 answer

How is Polly able to resend the same HTTP request?

An HttpRequestMessage can only be sent once. Attempting to resend it results in an InvalidOperationException. So how is Polly able to circumvent this behavior, in other words, what's going on under the covers when using AddPolicyHandler with a Retry…
silkfire
  • 24,585
  • 15
  • 82
  • 105
2
votes
1 answer

Unable to refresh token in Refit with Polly retry

I am trying to use Polly retry policy for handling unauthorised responses which require a token refresh. But I seem to be stuck in a loop. So the unauthorised error is captured and processed by Polly, I call a method to refresh the token which works…
jason.kaisersmith
  • 8,712
  • 3
  • 29
  • 51
2
votes
1 answer

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 of the Retry and not from all errors. For example,…
pampua84
  • 696
  • 10
  • 33
2
votes
1 answer

Polly retry not happening for WaitAndRetryAsync

I am new to Polly library and trying to use this library to retry connectivity to service bus on failures. I am using WaitAndRetryAsync to attempt retry for a specific times within intervals. There are 2 producer (mediatr events) who connect to…
V R
  • 33
  • 3
2
votes
1 answer

How to use HttpClient & Polly to have a Retry or Fallback Policy to retry with a different URL?

I'm new to Polly, but want to implement it as it seems like a good option for handling exponential backoff if an HTTP request fails. What I'd like to occur is that it tries using the original URL and if that request fails, it tries again but with…
AJ Tatum
  • 653
  • 2
  • 15
  • 35
2
votes
1 answer

TaskCanceledException not being caught when using httpclient with polly policy

I have a .net 6 console app that I configured with polly policies depending on what each service does. Program.cs try { //other setup code services .AddHttpClient() …
user19187727
  • 169
  • 9