コード例 #1
0
 /// <summary>
 /// 当前模式下使用注册中心发现服务
 /// </summary>
 /// <param name="clusterToken">集群授权码</param>
 /// <param name="redisConnection">注册中心链接地址</param>
 /// <param name="traceChain">链路管理</param>
 internal AbstractChannel(string clusterToken, ILog logger, string redisConnection, ITraceChain traceChain)
 {
     if (string.IsNullOrEmpty(clusterToken))
     {
         throw new ArgumentNullException(nameof(clusterToken));
     }
     _clientStub = new ClientStub(clusterToken, logger, redisConnection, traceChain);
 }
コード例 #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="clusterToken">集群授权码</param>
 internal AbstractChannel(string host, int port, string clusterToken, ILog logger)
 {
     if (string.IsNullOrEmpty(host))
     {
         throw new ArgumentNullException(nameof(host));
     }
     if (port < 0 || port > ushort.MaxValue)
     {
         throw new ArgumentException(nameof(port));
     }
     if (string.IsNullOrEmpty(clusterToken))
     {
         throw new ArgumentNullException(nameof(clusterToken));
     }
     _clientStub = new ClientStub(host, port, clusterToken, logger);
 }
コード例 #3
0
 /// <summary>
 /// 获取客户端访问类
 /// </summary>
 /// <param name="serviceType">服务类型</param>
 /// <param name="clientStub">存根</param>
 /// <returns>客户端访问对象</returns>
 protected abstract IClient InitializeClient(Type serviceType, ClientStub clientStub);
コード例 #4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="clientStub"></param>
 /// <param name="serviceType"></param>
 internal AbstractClient(ClientStub clientStub, Type serviceType)
 {
     _clientStub  = clientStub;
     _serviceInfo = _clientStub.GetOrSetServiceInfo(serviceType);
 }