Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RPC with protocol buffers

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.

like image 220
remdezx Avatar asked Nov 07 '13 13:11

remdezx


People also ask

What is RPC in Protobuf?

A RPC is a form of Client-Server Communication that uses a function call rather than a usual HTTP call. It uses IDL (Interface Definition Language) as a form of contract on functions to be called and on the data type. RPC Architecture. If you all haven't realized it yet, the RPC in gRPC stands for Remote Procedure Call ...

What is Protocol Buffers used for?

Protocol buffers provide a language-neutral, platform-neutral, extensible mechanism for serializing structured data in a forward-compatible and backward-compatible way. It's like JSON, except it's smaller and faster, and it generates native language bindings.

Can I use gRPC without Protobuf?

gRPC lets you use encoders other than Protobuf. It has no dependency on Protobuf and was specially made to work with a wide variety of environments.

What is difference between gRPC and RPC?

gRPC is a framework that uses RPC to communicate. RPC is not Protobuf but instead Protobuf can use RPC and gRPC is actually Protobuf over RPC. You don't need to use Protobuf to create RPC services within your app. This is a good idea if you are doing libraries/apps from small to medium size.


1 Answers

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

like image 70
Vitaly Isaev Avatar answered Sep 18 '22 05:09

Vitaly Isaev