コード例 #1
0
        public WebRequest(string resource, string serviceKey, IServiceDiscovery serviceDiscovery,
                          IFlurlClientFactory flurlClientFactory, DefaultFlurlHttpSettings defaultFlurlHttpSettings)
        {
            if (serviceKey == null)
            {
                throw new ArgumentNullException(nameof(serviceKey));
            }

            if (resource == null)
            {
                throw new ArgumentNullException(nameof(resource));
            }

            this.flurlClientFactory       = flurlClientFactory;
            this.defaultFlurlHttpSettings = defaultFlurlHttpSettings;

            url = serviceDiscovery.ResolveServiceUrl(serviceKey).AbsoluteUri.AppendPathSegment(resource);

            retryPolicy = Policy.Handle <CommunicationException>()
                          .RetryAsync((exception, retryCount) =>
            {
                Log.Warning(exception, $"Communication exception occured to {serviceKey} - {url.Path}");

                var serviceUri = serviceDiscovery.ResolveServiceUrl(serviceKey);
                url            = new UriBuilder(Url.Decode(url, false))
                {
                    Host = serviceUri.Host, Port = serviceUri.Port
                }.Uri;

                Log.Warning($"A new url to {serviceKey} was resolved on retry - {url.Path}");
            });
        }
コード例 #2
0
 public InternalRequestFactory(
     string serviceKey,
     IServiceDiscovery serviceDiscovery,
     IFlurlClientFactory flurlClientFactory,
     DefaultFlurlHttpSettings defaultFlurlHttpSettings)
     : base(serviceKey, serviceDiscovery, flurlClientFactory, defaultFlurlHttpSettings)
 {
 }
コード例 #3
0
        protected BaseRequestFactory(string serviceKey, IServiceDiscovery serviceDiscovery,
                                     IFlurlClientFactory flurlClientFactory, DefaultFlurlHttpSettings defaultFlurlHttpSettings)
        {
            this.serviceKey = serviceKey;

            this.serviceDiscovery         = serviceDiscovery;
            this.flurlClientFactory       = flurlClientFactory;
            this.defaultFlurlHttpSettings = defaultFlurlHttpSettings;
        }
コード例 #4
0
 public RequestFactory(
     ISdkClient client,
     IServiceDiscovery serviceDiscovery,
     IFlurlClientFactory flurlClientFactory,
     IEnumerable <ISdkConfig> configProvider,
     DefaultFlurlHttpSettings defaultFlurlHttpSettings)
     : base(client, serviceDiscovery, flurlClientFactory, configProvider, defaultFlurlHttpSettings)
 {
 }
コード例 #5
0
        protected BaseRequestFactory(ISdkClient client, IServiceDiscovery serviceDiscovery,
                                     IFlurlClientFactory flurlClientFactory, IEnumerable <ISdkConfig> configProvider,
                                     DefaultFlurlHttpSettings defaultFlurlHttpSettings)
        {
            serviceKey = configProvider.GetServiceKey(client.GetType());

            this.serviceDiscovery         = serviceDiscovery;
            this.flurlClientFactory       = flurlClientFactory;
            this.defaultFlurlHttpSettings = defaultFlurlHttpSettings;
        }