RPC with protocol buffers

别等时光非礼了梦想. 提交于 2019-12-23 12:06:22

问题


I'm tring to make rpc with protocol buffers and zeromq. Here is my proto file:

message SearchRequest {
  required string query = 1;
}

message SearchResponse {
  repeated Result result = 1;
}

message Result {
  required string url = 1;
  optional string title = 2;
  repeated string snippets = 3;
}

service SearchService {
  rpc Search (SearchRequest) returns (SearchResponse);
}

According to the tutorial I should get some service interface code and stubs for this rpc but I don't. Did I misunderstand something or am I doing it wrong?

I generate sources with $ protoc test.proto --cpp_out=gen-cpp and get test.ph.cc/h without SearchService in content.


回答1:


I did not do it on my own but it seems like your file is missing an option like option cc_generic_services = true; Look at the manual



来源:https://stackoverflow.com/questions/19836728/rpc-with-protocol-buffers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!