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));
        }
Exemple #2
0
 protected GrpcClientBase(GrpcClientOptions options, ISerializer serializer)
 {
     _channel    = new G.Channel(options.Url, options.Port, G.ChannelCredentials.Insecure);
     _invoker    = new G.DefaultCallInvoker(_channel);
     _serializer = serializer;
 }