[Question]: Request services from `AddTransientHttpErrorPolicy`
alexrosenfeld10 opened this issue · comments
What are you wanting to achieve?
This is possible:
.AddPolicyHandler((provider, message) =>
{
var logger = provider.GetRequiredService<ILogger>();
but I can't seem to find an equivalent here:
.AddTransientHttpErrorPolicy(policyBuilder => policyBuilder
... snip ...
,
onRetry: (outcome, timespan, retryAttempt, context) =>
Am I missing something? Or is this a gap?
What code or approach do you have so far?
See above for code
Additional context
No response
This is a question for the ASP.NET Core team -the AddTransientHttpErrorPolicy()
method lives in the Microsoft.Extensions.Http.Polly NuGet package which is part of the ASP.NET Core repository: dotnet/aspnetcore.
I'm not sure how much appetite they would have for adding a new method overload though, as that package is superseded by the new resilience libraries which are built on top of the new Polly v8 API and come from the dotnet/extensions repository.
Got it - I've moved over to those new libs, they're very nice. That said, they are missing some features as well, like getting access to the request message / request method.
Still very nice improvement though. I'll close this out.