Ejemplo n.º 1
0
        protected void OpenChannel(bool useTls,
                                   string clientCertificate = null,
                                   bool assumeLoadBalancer  = false)
        {
            if (string.IsNullOrEmpty(HostName))
            {
                _msg.Debug("Host name is null or empty. No channel opened.");
                return;
            }

            ChannelCredentials credentials =
                GrpcUtils.CreateChannelCredentials(useTls, clientCertificate);

            var enoughForLargeGeometries = (int)Math.Pow(1024, 3);

            Channel channel = GrpcUtils.CreateChannel(
                HostName, Port, credentials, enoughForLargeGeometries);

            if (assumeLoadBalancer)
            {
                ChannelIsLoadBalancer =
                    IsServingLoadBalancerEndpoint(channel, credentials, ServiceName,
                                                  enoughForLargeGeometries);
            }

            Channel = channel;

            _msg.DebugFormat("Created grpc channel to {0} on port {1}", HostName, Port);

            _healthClient = new Health.HealthClient(Channel);

            ChannelOpenedCore(Channel);
        }
Ejemplo n.º 2
0
        protected void OpenChannel(bool useTls, string clientCertificate = null)
        {
            if (string.IsNullOrEmpty(HostName))
            {
                _msg.Debug("Host name is null or empty. No channel opened.");
                return;
            }

            var enoughForLargeGeometries = (int)Math.Pow(1024, 3);

            ChannelCredentials credentials =
                GrpcUtils.CreateChannelCredentials(useTls, clientCertificate);

            Channel = GrpcUtils.CreateChannel(
                HostName, Port, credentials, enoughForLargeGeometries);

            _msg.DebugFormat("Created grpc channel to {0} on port {1}", HostName, Port);

            _healthClient = new Health.HealthClient(Channel);

            ChannelOpenedCore(Channel);
        }