コード例 #1
0
ファイル: GrpcClient.cs プロジェクト: orlando722/MassTransit
        public GrpcClient(IGrpcHostConfiguration hostConfiguration, IGrpcHostNode hostNode, TransportService.TransportServiceClient client, IGrpcNode node)
        {
            _hostConfiguration = hostConfiguration;
            _hostNode          = hostNode;
            _client            = client;
            _node = node;

            _runTask = Task.Run(() => RunAsync());
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }