Exemple #1
0
 private void Start(IServerListFactory serverListFactory, ServiceInfoHolder serviceInfoHolder)
 {
     rpcClient.Init(serverListFactory);
     rpcClient.Start();
     rpcClient.RegisterServerPushResponseHandler(new NamingPushRequestHandler(serviceInfoHolder));
     rpcClient.RegisterConnectionListener(namingGrpcConnectionEventListener);
 }
Exemple #2
0
        public NamingGrpcClientProxy(
            ILogger logger,
            string namespaceId,
            SecurityProxy securityProxy,
            IServerListFactory serverListFactory,
            NacosSdkOptions options,
            ServiceInfoHolder serviceInfoHolder)
        {
            this._logger        = logger;
            this.namespaceId    = namespaceId;
            this.uuid           = Guid.NewGuid().ToString();
            this._options       = options;
            this._securityProxy = securityProxy;

            this.requestTimeout = options.DefaultTimeOut > 0 ? options.DefaultTimeOut : 3000L;

            Dictionary <string, string> labels = new Dictionary <string, string>()
            {
                { RemoteConstants.LABEL_SOURCE, RemoteConstants.LABEL_SOURCE_SDK },
                { RemoteConstants.LABEL_MODULE, RemoteConstants.LABEL_MODULE_NAMING },
            };

            this.rpcClient = RpcClientFactory.CreateClient(uuid, RemoteConnectionType.GRPC, labels);

            this.namingGrpcConnectionEventListener = new NamingGrpcConnectionEventListener(_logger, this);

            Start(serverListFactory, serviceInfoHolder);
        }