public override void InitPipeServers(object o)
        {
            if (this.rr_InitPipeServersRun)
            {
                return;
            }
            this.rr_InitPipeServersRun = true;
            baseobj castobj = (baseobj)o;

            this.rr_p1 = new PipeServer <double[]>("p1", this);
            this.rr_w1 = new WireServer <double[]>("w1", this);
            castobj.p1 = this.rr_p1;
            castobj.w1 = this.rr_w1;
        }
Example #2
0
        static void Main_(string[] args)
        {
            _server = new WireServer(WireMockServer.Start());


            var id = Guid.NewGuid();

            Console.WriteLine("activity id: " + id);
            EventSource.SetCurrentThreadActivityId(id);


            RunAsync().Wait();

            do
            {
            } while (Console.ReadKey().Key != ConsoleKey.Escape);
        }
Example #3
0
        public void GlobalSetup()
        {
            _server = WireServer.Start();

            var serviceCollection = new ServiceCollection();


            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "basic";

                ConfigureJsonPlaceHolder(options);

                options.Handler.MaxConnection = null;
            });


            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-1";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 1;
            });

            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-5";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 5;
            });


            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-10";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 10;
            });


            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-20";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 20;
            });

            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-30";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 30;
            });

            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-30-hlt-10";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection          = 30;
                options.Handler.HandlerLifeTimeMinutes = 10;
            });
            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-30-hlt-20";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 30;
                ;
                options.Handler.HandlerLifeTimeMinutes = 20;
            });

            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-1000";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 1000;
            });

            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-30-hlt-2";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection          = 30;
                options.Handler.HandlerLifeTimeMinutes = 2;
            });
            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-40";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 40;
            });

            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-50";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 50;
            });
            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "max-connection-200";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = 200;
            });
            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "bulkhead-10";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection = null;
            });
            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "bulkhead-10-max-connection-20";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection             = 20;
                options.Polly.Bulkhead.Enabled            = true;
                options.Polly.Bulkhead.MaxParallelization = 10;
            });


            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "bulkhead-100";
                ConfigureJsonPlaceHolder(options);
                options.Polly.Bulkhead.Enabled            = true;
                options.Polly.Bulkhead.MaxParallelization = 100;
            });


            serviceCollection.AddHttpClientOptions(options =>
            {
                options.ServiceName = "bulkhead-100-max-connection-20";
                ConfigureJsonPlaceHolder(options);
                options.Handler.MaxConnection             = 20;
                options.Polly.Bulkhead.Enabled            = true;
                options.Polly.Bulkhead.MaxParallelization = 100;
            });

            var option = new HttpClientOptions();

            ConfigureJsonPlaceHolder(option);

            // _httpClient = new HttpClient()
            // {
            //     BaseAddress = option.ConnectionOptions.BaseUrl,
            // };


            _serviceProvider = serviceCollection.BuildServiceProvider();

            _factory = _serviceProvider.GetRequiredService <IHttpClientFactory>();
        }