• Using Polly with HttpClient factory from ASPNET Core 2.1 onwards
  • What is HttpClient factory?
  • Using Polly with IHttpClientFactory
  • Step 1 Reference the ASPNET Core 2.1 (or later) packages and Microsoft.Extensions.Http.Polly
  • Step 2 Configure a client with Polly policies, in Startup
  • Define a named HttpClient configuration
  • Fluently extend that client configuration with Polly policies
  • Step 3 Consume the configured HttpClient
  • How are the Polly policies applied?
  • Configuring the Polly policies
  • Using .AddTransientHttpErrorPolicy(...)
  • Using any policy configured via the traditional Polly syntax
  • Extending the convenience .AddTransientHttpErrorPolicy(...) definition
  • Applying multiple policies
  • What order are multiple policies applied in?
  • How does this compare to PolicyWrap?
  • Combining PolicyHttpMessageHandler with other DelegatingHandlers
  • Selecting policies dynamically
  • With stateful policies, use as selector, not factory
  • Selecting policies from a PolicyRegistry
  • Using a GetOrAdd(...)-style approach on PolicyRegistry
  • Use Case: Applying timeouts
  • If you configure TimeoutPolicy outside RetryPolicy
  • Use Case: scoping CircuitBreakers and Bulkheads
  • Use Case: CachePolicy
  • Is caching at the HttpResponseMessage level the right fit?
  • Considerations when caching HttpResponseMessage
  • Use Case: Exchanging information between policy execution and calling code
  • Configuring policies to use services registered with DI, such as ILogger<T>
  • Configuring HttpClientFactory policies to use an ILogger<T> from the call site