中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

做優(yōu)秀網(wǎng)站seo待遇

做優(yōu)秀網(wǎng)站,seo待遇,怎么免費(fèi)做文學(xué)網(wǎng)站,中秋網(wǎng)頁設(shè)計(jì)素材網(wǎng)站在Provider的實(shí)現(xiàn)中,OnMessage函數(shù)中,處理接收到的連接RPC請(qǐng)求。將接收到的RPC請(qǐng)求(包含請(qǐng)求的對(duì)象,請(qǐng)求方法和 請(qǐng)求參數(shù)),接收到這些信息之后進(jìn)行反序列化。得到這些參數(shù)之后我們即將要做的事情是去調(diào)用相…

?在Provider的實(shí)現(xiàn)中,OnMessage函數(shù)中,處理接收到的連接RPC請(qǐng)求。將接收到的RPC請(qǐng)求(包含請(qǐng)求的對(duì)象,請(qǐng)求方法和 請(qǐng)求參數(shù)),接收到這些信息之后進(jìn)行反序列化。得到這些參數(shù)之后我們即將要做的事情是去調(diào)用相應(yīng)的函數(shù)。怎么調(diào)用呢???

我們調(diào)用的方法名字如下,方法參數(shù)如下,需要根據(jù)發(fā)送來的信息找到該函數(shù)。

  void Login(::google::protobuf::RpcController* controller,const ::fixbug::LoginRequest* request,::fixbug::LoginResponse* response,::google::protobuf::Closure* done){// 框架給業(yè)務(wù)上報(bào)了請(qǐng)求參數(shù)LoginRequest,應(yīng)用獲取相應(yīng)數(shù)據(jù)做本地業(yè)務(wù)std::string name = request->name();std::string pwd = request->pwd();// 做本地業(yè)務(wù)bool login_result = Login(name, pwd); // 把響應(yīng)寫入  包括錯(cuò)誤碼、錯(cuò)誤消息、返回值fixbug::ResultCode *code = response->mutable_result();code->set_errcode(0);code->set_errmsg("");response->set_sucess(login_result);// 執(zhí)行回調(diào)操作   執(zhí)行響應(yīng)對(duì)象數(shù)據(jù)的序列化和網(wǎng)絡(luò)發(fā)送(都是由框架來完成的)done->Run();}

google::protobuf::Service *service = it->second.m_service; // 獲取service對(duì)象  new UserServiceconst google::protobuf::MethodDescriptor *method = mit->second; // 獲取method對(duì)象  Login// 生成rpc方法調(diào)用的請(qǐng)求request和響應(yīng)response參數(shù)google::protobuf::Message *request = service->GetRequestPrototype(method).New();if (!request->ParseFromString(args_str)){std::cout << "request parse error, content:" << args_str << std::endl;return;}google::protobuf::Message *response = service->GetResponsePrototype(method).New();// 給下面的method方法的調(diào)用,綁定一個(gè)Closure的回調(diào)函數(shù)google::protobuf::Closure *done = google::protobuf::NewCallback<RpcProvider, const muduo::net::TcpConnectionPtr&, google::protobuf::Message*>(this, &RpcProvider::SendRpcResponse, conn, response);// 在框架上根據(jù)遠(yuǎn)端rpc請(qǐng)求,調(diào)用當(dāng)前rpc節(jié)點(diǎn)上發(fā)布的方法// new UserService().Login(controller, request, response, done)service->CallMethod(method, nullptr, request, response, done);
}// Closure的回調(diào)操作,用于序列化rpc的響應(yīng)和網(wǎng)絡(luò)發(fā)送
void RpcProvider::SendRpcResponse(const muduo::net::TcpConnectionPtr& conn, google::protobuf::Message *response)
{std::string response_str;if (response->SerializeToString(&response_str)) // response進(jìn)行序列化{// 序列化成功后,通過網(wǎng)絡(luò)把rpc方法執(zhí)行的結(jié)果發(fā)送會(huì)rpc的調(diào)用方conn->send(response_str);}else{std::cout << "serialize response_str error!" << std::endl; }conn->shutdown(); // 模擬http的短鏈接服務(wù),由rpcprovider主動(dòng)斷開連接
}

?我們需要調(diào)用的函數(shù)如下:

  void Login(::google::protobuf::RpcController* controller,const ::fixbug::LoginRequest* request,::fixbug::LoginResponse* response,::google::protobuf::Closure* done)

?首先獲取調(diào)用的服務(wù)對(duì)象和方法:

?google::protobuf::Service *service = it->second.m_service; // 獲取service對(duì)象 ?new UserService

? ? const google::protobuf::MethodDescriptor *method = mit->second; // 獲取method對(duì)象 ?Login

?獲取方法的參數(shù):request和response,這些

google::protobuf::Message *request = service->GetRequestPrototype(method).New();

? ? if (!request->ParseFromString(args_str))

? ? {

? ? ? ? std::cout << "request parse error, content:" << args_str << std::endl;

? ? ? ? return;

? ? }

? ? google::protobuf::Message *response = service->GetResponsePrototype(method).New();

http://www.risenshineclean.com/news/3959.html

相關(guān)文章:

  • 網(wǎng)站 框架圖希愛力副作用太強(qiáng)了
  • 網(wǎng)站在線制作生成個(gè)人網(wǎng)站推廣
  • 做網(wǎng)站真實(shí)收益騰訊云域名購買
  • 刷網(wǎng)站關(guān)做個(gè)網(wǎng)站需要多少錢
  • 貴陽網(wǎng)站建設(shè)q.479185700棒谷歌瀏覽器在線入口
  • 網(wǎng)站關(guān)鍵詞排名優(yōu)化應(yīng)該怎么做培訓(xùn)心得總結(jié)怎么寫
  • 黑龍江住房和城鄉(xiāng)建設(shè)廳網(wǎng)站seo網(wǎng)站排名優(yōu)化公司
  • 免費(fèi)的站外推廣網(wǎng)絡(luò)營銷專業(yè)是學(xué)什么的
  • 網(wǎng)站開發(fā)搜索功能怎么實(shí)現(xiàn)泰安做百度推廣的公司
  • 株洲網(wǎng)站設(shè)計(jì)外包運(yùn)營百度廣告電話號(hào)碼是多少
  • wordpress 付費(fèi)下資源 插件武漢網(wǎng)站營銷seo方案
  • 主題資源網(wǎng)站制作平臺(tái)騰訊會(huì)議多少錢一個(gè)月
  • 做相框的網(wǎng)站富陽網(wǎng)站seo價(jià)格
  • 建一個(gè)公司網(wǎng)站網(wǎng)站營銷策劃
  • 分析一個(gè)網(wǎng)站湖南網(wǎng)絡(luò)推廣機(jī)構(gòu)
  • 公司做網(wǎng)站的費(fèi)用記到哪個(gè)科目推廣引流網(wǎng)站
  • 深圳做公司網(wǎng)站他達(dá)拉非片
  • ninety wordpress插件湖南網(wǎng)站seo地址
  • 幫一個(gè)企業(yè)做網(wǎng)站流程網(wǎng)絡(luò)整合營銷是什么意思
  • 電影網(wǎng)站域名seo營銷推廣
  • 沒有網(wǎng)站可以做seo排名嗎個(gè)人對(duì)網(wǎng)絡(luò)營銷的看法
  • 安徽做網(wǎng)站的公司專門做推廣的公司
  • 創(chuàng)業(yè)網(wǎng)站怎么做如何推廣自己的微信公眾號(hào)
  • 山西網(wǎng)站建設(shè)設(shè)計(jì)百度seo
  • 做調(diào)查問卷用的網(wǎng)站或軟件今日百度搜索風(fēng)云榜
  • 用php做網(wǎng)站難嗎南昌seo全網(wǎng)營銷
  • 重慶市工程建設(shè)信息網(wǎng)新網(wǎng)站網(wǎng)頁設(shè)計(jì)圖
  • wordpress 反應(yīng)慢seo網(wǎng)站優(yōu)化推廣教程
  • 網(wǎng)站建設(shè)畢業(yè)論文5000字國內(nèi)廣告投放平臺(tái)
  • 官方查企業(yè)信息的網(wǎng)站廣州網(wǎng)站快速排名