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"); }
private static void StartThriftyServer(int port) { var factory = new LoggerFactory(); factory.AddConsole(LogLevel.Debug); var serverConfig = new ThriftyServerOptions(); var bootStrap = new ThriftyBootstrap(new DelegateServiceLocator( (ctx, x) => new Thrifty.ScribeTest()), serverConfig, new InstanceDescription("SampleApp", "TestApp122", PublicAddress), factory); var future = bootStrap .AddService(typeof(Thrifty.IScribe), "0.0.1") .EurekaConfig(true, new EurekaClientConfig { EurekaServerServiceUrls = "http://10.66.4.68:8761/eureka" }) .Bind("localhost", port) .StartAsync(); }