Ejemplo n.º 1
0
        public async Task <RpcResult <EditUserRsp> > EditAsync(EditUserReq req, int timeOut = 3000)
        {
            AmpMessage message = AmpMessage.CreateRequestMessage(20003, 3);

            message.FriendlyServiceName = "UserService.Edit";
            message.Data = req.ToByteArray();
            var response = await base.CallInvoker.AsyncCall(message, timeOut);

            if (response == null)
            {
                throw new RpcException("error,response is null !");
            }
            var result = new RpcResult <EditUserRsp>();

            if (response.Code != 0)
            {
                result.Code = response.Code;
            }

            if (response.Data == null)
            {
                result.Data = new EditUserRsp();
            }
            else
            {
                result.Data = EditUserRsp.Parser.ParseFrom(response.Data);
            }

            return(result);
        }
Ejemplo n.º 2
0
        //同步方法
        public RpcResult <EditUserRsp> Edit(EditUserReq req)
        {
            AmpMessage message = AmpMessage.CreateRequestMessage(20003, 3);

            message.FriendlyServiceName = "UserService.Edit";


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

            if (response == null)
            {
                throw new RpcException("error,response is null !");
            }
            var result = new RpcResult <EditUserRsp>();

            if (response.Code != 0)
            {
                result.Code = response.Code;
            }

            if (response.Data == null)
            {
                result.Data = new EditUserRsp();
            }
            else
            {
                result.Data = EditUserRsp.Parser.ParseFrom(response.Data);
            }

            return(result);
        }