//同步方法
        public RpcResult <QPaperListRsp> QueryQPaperList(QueryQPaperReq req)
        {
            AmpMessage message = AmpMessage.CreateRequestMessage(20001, 2);

            message.FriendlyServiceName = "QPaperInnerService.QueryQPaperList";


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

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

            if (response.Code != 0)
            {
                result.Code = response.Code;
            }
            else if (response.Data == null)
            {
                result.Code = ErrorCodes.CODE_INTERNAL_ERROR;
            }
            else
            {
                result.Data = QPaperListRsp.Parser.ParseFrom(response.Data);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public async Task <RpcResult <QPaperListRsp> > QueryQPaperListAsync(QueryQPaperReq req, int timeOut = 3000)
        {
            AmpMessage message = AmpMessage.CreateRequestMessage(20001, 2);

            message.FriendlyServiceName = "QPaperService.QueryQPaperList";
            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 <QPaperListRsp>();

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

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

            return(result);
        }