-
Notifications
You must be signed in to change notification settings - Fork 339
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
Introduce HttpClientFactory in HttpClient #2036
Comments
Noting through those posts it makes the point that it's not the actual HttpClient that is the issue, its the HttpMessageHandler that is the problem, and that's the thing you need to hang onto and the Factory helps manage things better. |
I think with these changes to include the HttpClient via the constructor, then we don't need to do the HttpClientHandlerFactory stuff, and if someone wants to use that stuff, they can and we don't need to be involved. |
The HttpClientFactory creates and manages HttpClient instances and takes an available message handler from the pool. The HttpClient should be included in the constructor rather than the factory, so the consumer can reuse the same HttpClient. |
@ewoutkramer, Now that the 3.8.3 and 4 beta release have the httpclient in the constructor of the fhirclient, I think we can close this issue as it enables the HttpClientFactory to be used without change in this library |
In (closed) issue #2032 , the discussion centered around re-using instances of the HttpClient. Currently, every instance of the FhirClient creates an instance of the HttpClient, but Microsoft recommends having a single HttpClient per application - which means the FhirClient should re-use one single instance.
Describe the solution you'd like
@brianpos suggests using a class called
HttpClientFactory
but it is unclear to me how this solves the problem.Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
See issue the discussion in #2032 for more info.
The text was updated successfully, but these errors were encountered: