示例#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");
        }