Polly.Extensions.Http | extensions package containing opinionated convenience | HTTP library
kandi X-RAY | Polly.Extensions.Http Summary
kandi X-RAY | Polly.Extensions.Http Summary
Polly.Extensions.Http is an extensions package containing opinionated convenience methods for configuring Polly policies to handle transient faults typical of calls through HttpClient. Polly.Extensions.Http targets .NET Standard 1.1 and .NET Standard 2.0. Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Polly.Extensions.Http
Polly.Extensions.Http Key Features
Polly.Extensions.Http Examples and Code Snippets
using Polly.Extensions.Http;
// ..
// Handles HttpRequestException, Http status codes >= 500 (server errors) and status code 408 (request timeout)
var policy = HttpPolicyExtensions
.HandleTransientHttpError()
.RetryAsync(3); // A very simple
var retryPolicy = HttpPolicyExtensions
.HandleTransientHttpError()
.Or() // thrown by Polly's TimeoutPolicy if the inner execution times out
.RetryAsync(3);
var timeoutPolicy = Policy.TimeoutAsync(10);
serviceCollection.AddHttpClient("examp
Community Discussions
Trending Discussions on Polly.Extensions.Http
QUESTION
I have the following retry policy which uses Polly.Extensions.Http
:
ANSWER
Answered 2018-Dec-27 at 10:30When policy configuration uses .HandleTransientHttpError()
or .OrTransientHttpError()
, the policies are configured to handle specific status code results of an execution returning HttpResponseMessage
.
This makes the returned policies of a type which fulfils the generic interface IAsyncPolicy
rather than the non-generic IAsyncPolicy
.
To create a generic PolicyWrap
using the PolicyWrap static syntax you must specify the generic type parameter explicitly:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Polly.Extensions.Http
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page