public async Task <RpcResult <AddRes> > AddAsync(AddReq req, int timeOut = 3000) { AmpMessage message = AmpMessage.CreateRequestMessage(10005, 1); message.FriendlyServiceName = "Math.Add"; 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 <AddRes>(); if (response.Code != 0) { result.Code = response.Code; } if (response.Data == null) { result.Data = new AddRes(); } else { result.Data = AddRes.Parser.ParseFrom(response.Data); } return(result); }
//同步方法 public RpcResult <AddRes> Add(AddReq req) { AmpMessage message = AmpMessage.CreateRequestMessage(10005, 1); message.FriendlyServiceName = "Math.Add"; message.Data = req.ToByteArray(); var response = base.CallInvoker.BlockingCall(message); if (response == null) { throw new RpcException("error,response is null !"); } var result = new RpcResult <AddRes>(); if (response.Code != 0) { result.Code = response.Code; } if (response.Data == null) { result.Data = new AddRes(); } else { result.Data = AddRes.Parser.ParseFrom(response.Data); } return(result); }
//同步方法 public AddRes Add(AddReq request) { AmpMessage message = AmpMessage.CreateRequestMessage(10005, 1); 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 AddRes()); } return(AddRes.Parser.ParseFrom(response.Data)); }
public async Task <AddRes> AddAsync(AddReq request, int timeOut = 3000) { AmpMessage message = AmpMessage.CreateRequestMessage(10005, 1); 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 AddRes()); } return(AddRes.Parser.ParseFrom(response.Data)); }