Skip to content

[Microsoft.Extensions.Http.Resilience] Circuit-breaker: shared policy, CustomCircuitBreakerStateProvider per client? #5471

Discussion options

You must be logged in to vote

Hello @natwallbank,

If understood you correctly then you were trying to create a single shared resilience pipeline but to have its CircuitBreakerStrategy being distinct per each named HttpClient, right? If so then such a scenario is not supported out of the box, and I would say is not standard. I would personally prefer the approach you suggested define a policy per-client and share the strategies:

// Clients "default" and "custom" share resilience strategies, but each has its own instance of the strategies.
// In particular, each client has its own CircuitBreaker, StateProvider, and ManualControl.
services.AddHttpClient("default").AddResilienceHandler("default-client", DefaultPipeline);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by RussKie
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #5463 on October 04, 2024 03:03.