带有协议缓冲区的 RPC [英] RPC with protocol buffers

查看:80
本文介绍了带有协议缓冲区的 RPC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用协议缓冲区和 zeromq 制作 rpc.这是我的原型文件:

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);
}

根据教程,我应该得到一些服务接口代码和这个 rpc 的存根,但我没有.是我误解了什么还是我做错了?

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?

我使用 $ protoc test.proto --cpp_out=gen-cpp 生成源代码,并在没有 SearchService 的情况下获得 test.ph.cc/h> 内容.

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

推荐答案

我不是自己做的,但您的文件似乎缺少一个选项,例如 option cc_generic_services = true;查看手册

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

这篇关于带有协议缓冲区的 RPC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆