Example #1
0
        public async Task <VoidRsp> SaveAsync(AccountReq request, int timeOut = 3000)
        {
            AmpMessage message = AmpMessage.CreateRequestMessage(1001, 3);

            message.Data = request.ToByteArray();
            var response = await base.CallInvoker.AsyncCall(message, timeOut);

            if (response == null)
            {
                throw new RpcException("error,response is null !");
            }
            if (response.Data == null)
            {
                return(new VoidRsp());
            }
            return(VoidRsp.Parser.ParseFrom(response.Data));
        }
Example #2
0
//同步方法
        public VoidRsp Save(AccountReq request)
        {
            AmpMessage message = AmpMessage.CreateRequestMessage(1001, 3);

            message.Data = request.ToByteArray();
            var response = base.CallInvoker.BlockingCall(message);

            if (response == null)
            {
                throw new RpcException("error,response is null !");
            }
            if (response.Data == null)
            {
                return(new VoidRsp());
            }
            return(VoidRsp.Parser.ParseFrom(response.Data));
        }