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}"); }); }
public InternalRequestFactory( string serviceKey, IServiceDiscovery serviceDiscovery, IFlurlClientFactory flurlClientFactory, DefaultFlurlHttpSettings defaultFlurlHttpSettings) : base(serviceKey, serviceDiscovery, flurlClientFactory, defaultFlurlHttpSettings) { }
protected BaseRequestFactory(string serviceKey, IServiceDiscovery serviceDiscovery, IFlurlClientFactory flurlClientFactory, DefaultFlurlHttpSettings defaultFlurlHttpSettings) { this.serviceKey = serviceKey; this.serviceDiscovery = serviceDiscovery; this.flurlClientFactory = flurlClientFactory; this.defaultFlurlHttpSettings = defaultFlurlHttpSettings; }
public RequestFactory( ISdkClient client, IServiceDiscovery serviceDiscovery, IFlurlClientFactory flurlClientFactory, IEnumerable <ISdkConfig> configProvider, DefaultFlurlHttpSettings defaultFlurlHttpSettings) : base(client, serviceDiscovery, flurlClientFactory, configProvider, defaultFlurlHttpSettings) { }
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; }