Esempio n. 1
0
        public async Task <IResponseMessage> SendAsync(IRequestMessage requestMessage)
        {
            try
            {
                var response = await dummyResponderClient.RipostAsync(new Request()
                {
                    Message = requestMessage.Message
                }, null);

                return(new ResponseMessage()
                {
                    Message = response.Message
                });
            }
            catch (RpcException ex) when(ex.StatusCode == StatusCode.InvalidArgument)
            {
                return(new ResponseMessage()
                {
                    Message = ex.Status.Detail
                });
            }
            catch (RpcException ex) when(ex.StatusCode == StatusCode.Aborted)
            {
                channel.Dispose();
                channel = GrpcChannel.ForAddress("https://localhost:5001");

                dummyResponderClient = new DummyResponder.DummyResponderClient(channel);

                return(new ResponseMessage()
                {
                    Message = ex.Status.Detail
                });
            }
        }
Esempio n. 2
0
        public Client()
        {
            channel = GrpcChannel.ForAddress("https://localhost:5001");

            dummyResponderClient = new DummyResponder.DummyResponderClient(channel);
        }