Interface IForwarderHttpClientFactory
- Namespace
- Yarp.ReverseProxy.Forwarder
- Assembly
- Yarp.ReverseProxy.dll
Provides a method to create instances of HttpMessageInvoker for forwarding requests to an upstream server.
public interface IForwarderHttpClientFactory
Remarks
This is somewhat similarly to System.Net.Http.IHttpClientFactory
,
except that this factory class is meant for direct use,
which the forwarder requires in order to keep separate pools for each cluster.
Methods
CreateClient(ForwarderHttpClientContext)
Creates and configures an HttpMessageInvoker instance that can be used for forwarding requests to an upstream server.
HttpMessageInvoker CreateClient(ForwarderHttpClientContext context)
Parameters
context
ForwarderHttpClientContextAn ForwarderHttpClientContext carrying old and new cluster configurations.
Returns
Remarks
A call to CreateClient(ForwarderHttpClientContext) can return either a new HttpMessageInvoker instance or an old one if the configuration has not changed. If the old configuration is null, a new HttpMessageInvoker is always created. The returned HttpMessageInvoker instance MUST NOT be disposed because it can be used concurrently by several in-flight requests.