コード例 #1
0
        public AutoCompleteServiceQuery(IAppConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _serviceDiscoveryClient          = new ServiceDiscoveryClient(configuration.ServiceDiscoveryUri);
            _autocompleteServiceResourceType = configuration.AutocompleteServiceResourceType;
            _httpClient = new RetryingHttpClientWrapper(new HttpClient());
        }
コード例 #2
0
        public AutocompleteServiceQuery(IAppConfiguration configuration, IResilientSearchClient resilientSearchClient, IFeatureFlagService featureFlagService)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _serviceDiscoveryClient          = new ServiceDiscoveryClient(configuration.ServiceDiscoveryUri);
            _autocompleteServiceResourceType = configuration.AutocompleteServiceResourceType;
            _httpClientToDeprecate           = new RetryingHttpClientWrapper(new HttpClient(), QuietLog.LogHandledException);
            _resilientSearchClient           = resilientSearchClient;
            _featureFlagService = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
        }
コード例 #3
0
        /// <summary>
        /// Create a search service client from the specified base uri and credentials.
        /// </summary>
        /// <param name="baseUri">The URL to the root of the service</param>
        /// <param name="resourceType">Resource type to query against</param>
        /// <param name="credentials">The credentials to connect to the service with</param>
        /// <param name="healthIndicatorStore">Health indicator store</param>
        /// <param name="handlers">Handlers to apply to the request in order from first to last</param>
        public SearchClient(Uri baseUri, string resourceType, ICredentials credentials, IEndpointHealthIndicatorStore healthIndicatorStore, params DelegatingHandler[] handlers)
        {
            _resourceType = resourceType;

            // Link the handlers
            HttpMessageHandler handler = new HttpClientHandler()
            {
                Credentials = credentials,
                AllowAutoRedirect = true,
                UseDefaultCredentials = credentials == null
            };

            foreach (var providedHandler in handlers.Reverse())
            {
                providedHandler.InnerHandler = handler;
                handler = providedHandler;
            }

            var httpClient = new HttpClient(handler, disposeHandler: true);

            _retryingHttpClientWrapper = new RetryingHttpClientWrapper(httpClient, healthIndicatorStore);
            _discoveryClient = new ServiceDiscoveryClient(httpClient, baseUri);
        }
コード例 #4
0
 public AutocompleteServicePackageVersionsQuery(IAppConfiguration configuration)
 {
     _serviceDiscoveryClient = new ServiceDiscoveryClient(configuration.ServiceDiscoveryUri);
     _autocompleteServiceResourceType = configuration.AutocompleteServiceResourceType;
     _httpClient = new RetryingHttpClientWrapper(new HttpClient());
 }
コード例 #5
0
 public AutocompleteServicePackageVersionsQuery(IAppConfiguration configuration)
 {
     _serviceDiscoveryClient          = new ServiceDiscoveryClient(configuration.ServiceDiscoveryUri);
     _autocompleteServiceResourceType = configuration.AutocompleteServiceResourceType;
     _httpClient = new RetryingHttpClientWrapper(new HttpClient());
 }