Example #1
0
        public void OpenServer()
        {
            LoggerFactory loggerFac = new LoggerFactory();

#if DEBUG
            loggerFac.AddConsole(LogLevel.None);
#endif

            ThriftyServerOptions svrOptions = new ThriftyServerOptions
            {
                BindingAddress = "127.0.0.1",
                Port           = this.Port
            };
            svrOptions.Eureka.EurekaServerServiceUrls = this.EurekaAddress;

            ThriftyClientOptions cltOptions = new ThriftyClientOptions()
            {
                ConnectionPoolEnabled = this.EnableConnectionPool
            };
            cltOptions.Eureka.EurekaServerServiceUrls = this.EurekaAddress;


            _server = new ThriftyBootstrap(
                new DelegateServiceLocator((r, t) => new LogCase()),
                svrOptions,
                new InstanceDescription("test-case1", "test-case1"), loggerFac);
            _server.AddService <ISimpleCase>();

            _server.StartAsync().GetAwaiter().GetResult();
            _client = new ThriftyClient(cltOptions);
            _proxy  = _client.Create <ISimpleCase>("127.0.0.1:6666");
        }
Example #2
0
        public static void Main(string[] args)
        {
            var factory = new LoggerFactory();

            using (var client = new ThriftyClient(new ThriftyClientOptions
            {
                LoggerFactory = factory,
                ConnectionPoolEnabled = false
            }))
            {
                var service = client.Create <IService>("127.0.0.1:9999", new ClientSslConfig
                {
                    CertFile     = "ca.crt",
                    FileProvider = new EmbeddedFileProvider(typeof(ClientProgram).GetTypeInfo().Assembly)
                });
                for (var i = 0; i < 1024 * 1024; i++)
                {
                    var x = i;
                    Console.WriteLine($" {x} Invoke");
                    TestAll(service);
                }
            }
            Console.WriteLine("Finish");
            Console.ReadKey();
        }