Reputation: 1200
I need to use Polly.Extensions.Http for same reason.
I install Polly and Polly.Extensions.Http packages, and have these using's
global using Polly;
global using Polly.Retry;
global using Polly.Timeout;
global using Polly.Extensions.Http;
but when need add to HttpClient, It's not available!
Upvotes: 1
Views: 2774
Reputation: 11281
To summarize the discussion in the comments:
Polly.Extensions.Http
package is deprecated. It has not been modified more than 3 years."Polly
with the HttpClientFactory
is described in the wiki of the Polly
github. It seems to use Microsoft.Extensions.Http.Polly
.E.g.
services.AddHttpClient("GitHub", client =>
{
client.BaseAddress = new Uri("https://api.github.com/");
client.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3+json");
})
.AddTransientHttpErrorPolicy(builder => builder.WaitAndRetryAsync(new[]
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(5),
TimeSpan.FromSeconds(10)
}));
Upvotes: 3