Class DiscoveryHttpMessageHandler
A DelegatingHandler implementation that performs Service Discovery
public class DiscoveryHttpMessageHandler : DelegatingHandler, IDisposable
- Inheritance
-
DiscoveryHttpMessageHandler
- Implements
- Inherited Members
Constructors
DiscoveryHttpMessageHandler(IDiscoveryClient, ILogger<DiscoveryHttpClientHandler>, ILoadBalancer)
Initializes a new instance of the DiscoveryHttpMessageHandler class.
public DiscoveryHttpMessageHandler(IDiscoveryClient discoveryClient, ILogger<DiscoveryHttpClientHandler> logger = null, ILoadBalancer loadBalancer = null)
Parameters
discoveryClientIDiscoveryClientService discovery client to use - provided by calling services.AddDiscoveryClient(Configuration)
loggerILogger<DiscoveryHttpClientHandler>ILogger for capturing logs from Discovery operations
loadBalancerILoadBalancerThe load balancer to use
Methods
SendAsync(HttpRequestMessage, CancellationToken)
Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
requestHttpRequestMessageThe HTTP request message to send to the server.
cancellationTokenCancellationTokenA cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
The
requestwas null.