Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: Request services from AddTransientHttpErrorPolicy #1998

Closed
alexrosenfeld10 opened this issue Feb 29, 2024 · 2 comments
Closed

[Question]: Request services from AddTransientHttpErrorPolicy #1998

alexrosenfeld10 opened this issue Feb 29, 2024 · 2 comments
Labels

Comments

@alexrosenfeld10
Copy link

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

@martincostello
Copy link
Member

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.

@alexrosenfeld10
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants