public GrpcClient(IGrpcHostConfiguration hostConfiguration, IGrpcHostNode hostNode, TransportService.TransportServiceClient client, IGrpcNode node) { _hostConfiguration = hostConfiguration; _hostNode = hostNode; _client = client; _node = node; _runTask = Task.Run(() => RunAsync()); }
public async Task <User> Zalupa() { var client = new TransportService.TransportServiceClient(channel); UserRequest request = new UserRequest { IdUser = 1 }; User user = client.GetOneOfUser(request); return(await Task.FromResult(user)); }
IGrpcClient GetClient(Uri address) { var channel = GrpcChannel.ForAddress(address.GetLeftPart(UriPartial.Authority), new GrpcChannelOptions { Credentials = ChannelCredentials.Insecure, MaxReceiveMessageSize = MaxMessageLengthBytes }); var client = new TransportService.TransportServiceClient(channel); var clientNodeContext = new ClientNodeContext(address); var node = _nodeCollection.GetNode(clientNodeContext); return(new GrpcClient(_hostConfiguration, _hostNode, client, node)); }