I am using AddHttpClient and AddResilienceHandler to create and configure HttpClient in HostBuilder that will inject the httpclient in my other projects to handle specific http requests to different websites.
My question is should AddResilienceHandler in the startup code? Some resilience methods are more website specific, like DelayGenerator in AddRetry. Normally such logics are specified in the child projects per website as an example.
Now with AddResilienceHandler, we are shifting the logics to the startup method. Wouldn't it make startup method too complex to code and manage? Surely the child project owners have better idea how to configure and handle retry etc, not the caller of such projects in the startup method.
If we need to config 10+ httpClient with different resilience handlers, startup method will be huge.
In additional, how to access logger in AddResilienceHandler?
IServiceCollectionextension methods inside each client project to allow them register whatever HttpClient they need (either resilience handler decorated or pure)?AddClientSpecificHttpClientmethods if you restrict the extension methods' name.