コード例 #1
0
        public BaseApiClient(ILogger logger, ApiClientSettings settings)
        {
            this.logger   = logger;
            this.settings = settings;

            httpClient = new HttpClient
            {
                Timeout     = settings.DefaultTimeout,
                BaseAddress = settings.EndpointUrl
            };
        }
コード例 #2
0
ファイル: BaseApiClient.cs プロジェクト: samstikhin/Ulearn
        protected BaseApiClient(ApiClientSettings settings)
        {
            this.settings = settings;

            clusterClient = new ClusterClient(log, config =>
            {
                config.SetupUniversalTransport();
                config.DefaultTimeout = settings.DefaultTimeout;
                config.SetupDistributedKonturTracing();
                config.ClusterProvider        = new FixedClusterProvider(settings.EndpointUrl);
                config.TargetServiceName      = settings.ServiceName;
                config.DefaultRequestStrategy = Strategy.SingleReplica;
                config.SetupResponseCriteria(
                    //new AcceptNonRetriableCriterion(), // Пока у нас одна реплика, используем результат, какой есть
                    //new RejectNetworkErrorsCriterion(),
                    //new RejectServerErrorsCriterion(),
                    //new RejectThrottlingErrorsCriterion(),
                    //new RejectUnknownErrorsCriterion(),
                    //new RejectStreamingErrorsCriterion(),
                    new AlwaysAcceptCriterion()
                    );
            });
        }