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

WintonExtensions and Polly retry policies #100

Open
TheDouye opened this issue Apr 29, 2020 · 3 comments
Open

WintonExtensions and Polly retry policies #100

TheDouye opened this issue Apr 29, 2020 · 3 comments

Comments

@TheDouye
Copy link

TheDouye commented Apr 29, 2020

Hi.
Not sure this is the right place to post so do not hesitate to tell me.
I would like to use a retry policy (for instance with Polly) whenever a request fails. But I'm not sure the current API allows me to do this. Or I don't know how to do it :).
So what is the best way to achieve this ?

I am able to do it in the OnLoadException callback by forcing context.Source.Build(configurationBuilder).Load() and finally add it the current IConfigurationBuilder but for me we should be able to apply the policy directly on the Load method of the ConsulConfigurationProvider class, shouldn't we ?

I can also create a ConfigurationBuilder and add ConsulConfigurationSource (s) only, call the Build method, retry as long as it fails, and finally add the created IConfiguration to the ConfigurationBuilder that will be used in my StartUp (bootstrap) class.

Thx a lot and have a good day

@Choc13
Copy link
Collaborator

Choc13 commented May 6, 2020

@TheDouye thanks for opening this. I've been a bit busy with other things recently, but I'll try and get back to you with a proper answer shortly. One thing that jumped to mind was that you can access the underlying HttpClient through the ConsulHttpClientOptions property when configuring the Consul config source. From the limited knowledge I have about Polly I thought that it might be possible to integrate it through there?

If that doesn't work or is particularly cumbersome then please let me know. I'd be open to improving the functionality in this area. I think it would be good to make it possible to make the initial load more resilient if clients want that behaviour. I wouldn't want to add a direct dependency on anything like Polly though, so we'd need to find a way to create an interface enabled this.

@TheDouye
Copy link
Author

TheDouye commented Jun 5, 2020

Hello
Really sorry for not having answered :(. Actually we just used Polly around the Build method after adding Consul as a configuration source (it has some drawbacks...). From what I remembered we could not use the HttpClient (the HttpClientFactory would have been more usefull)
Thx

@muratyuceer
Copy link
Contributor

Hi @TheDouye did fixed your problem? You can share with us :)

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

No branches or pull requests

3 participants