private static void StartThriftyServer(int port, string eurekaServer) { var factory = new LoggerFactory(); factory.AddConsole(LogLevel.Debug); var serverConfig = new ThriftyServerOptions { QueueTimeout = TimeSpan.FromMinutes(1), TaskExpirationTimeout = TimeSpan.FromMinutes(1) }; var bootStrap = new ThriftyBootstrap(new object[] { new ScribeTest() }, serverConfig, new InstanceDescription("SampleApp", "TestApp122", PublicAddress), factory); bootStrap .SslConfig(new SslConfig { CertFile = "server.pfx", CertPassword = "******", CertFileProvider = new EmbeddedFileProvider(typeof(Program).GetTypeInfo().Assembly) }) .AddService(typeof(IScribe), "0.0.1") .EurekaConfig(!String.IsNullOrWhiteSpace(eurekaServer), new EurekaClientConfig { EurekaServerServiceUrls = eurekaServer }) .Bind(PublicAddress, port) .StartAsync(); ThriftSerializer s = new ThriftSerializer(ThriftSerializer.SerializeProtocol.Binary); }
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(); }