コード例 #1
0
        public DefaultRpcChannel(IRpcServiceDiscovery rpcServiceDiscovery, ISerializer serializer, IOptions <RpcClientOptions> options)
        {
            var(host, port) = rpcServiceDiscovery == null
                ? (options.Value.Host, options.Value.Port)
                : rpcServiceDiscovery.ResolveAsync().ConfigureAwait(false).GetAwaiter().GetResult();
            var channel = new GrpcCore.Channel(host, port, GrpcCore.ChannelCredentials.Insecure);

            this._invoker    = new GrpcCore.DefaultCallInvoker(channel);
            this._serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
        }
コード例 #2
0
ファイル: GrpcClientBase.cs プロジェクト: GreatGeorge1/Grpc
 protected GrpcClientBase(GrpcClientOptions options, ISerializer serializer)
 {
     _channel    = new G.Channel(options.Url, options.Port, G.ChannelCredentials.Insecure);
     _invoker    = new G.DefaultCallInvoker(_channel);
     _serializer = serializer;
 }