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"); }
public NoneClientChannelPool(ThriftClientManager thriftClientManager, ThriftyClientOptions options) { Guard.ArgumentNotNull(options, nameof(options)); Guard.ArgumentNotNull(thriftClientManager, nameof(thriftClientManager)); _thriftClientManager = thriftClientManager; _options = options; }
public NiftyClientChannelFactory(ThriftClientManager thriftClientManager, ThriftyClientOptions options) { Guard.ArgumentNotNull(options, nameof(options)); Guard.ArgumentNotNull(thriftClientManager, nameof(thriftClientManager)); _createChannel = key => { var connector = new FramedClientConnector(key.IpEndPoint.Address.ToString(), key.IpEndPoint.Port, _options.LoggerFactory); var channel = thriftClientManager.CreateChannelAsync(connector, TimeSpan.FromMilliseconds(key.ConnectionTimeout), TimeSpan.FromMilliseconds(key.ReceiveTimeout), TimeSpan.FromMilliseconds(key.ReadTimeout), TimeSpan.FromMilliseconds(key.WriteTimeout), _options.MaxFrameSize, key.SslConfig, _options.SocketProxy); return(channel.GetAwaiter().GetResult()); }; _options = options; }
public NiftyClientChannelPool(ThriftClientManager thriftClientManager, IEvictionTimer timer, ThriftyClientOptions options) : base(new NiftyClientChannelFactory(thriftClientManager, options), options.ConnectionPool, timer, options.LoggerFactory) { }