I'm trying to use protobuf to generate a service using RpcChannel and RpcController. I referred to language guide of google protobuf and:
I've got sample proto file like this:
syntax = "proto2";
message SearchRequest
{
required string Request = 1;
}
message SearchResponse
{
required string Response = 2;
}
service SearchService {
rpc Search (SearchRequest) returns (SearchResponse);
}
Then I compiled it with:
protoc --cpp_out=./ examples.proto
I got .h and .cc files. But when I search the generated code, I only found classes for "Request" and "Response", but not a class for "SearchService":
examples.pb.h:class SearchRequest;
examples.pb.h:class SearchResponse;
examples.pb.h:class SearchRequest : public ::google::protobuf::Message {
examples.pb.h: // @@protoc_insertion_point(class_scope:SearchRequest)
examples.pb.h:class SearchResponse : public ::google::protobuf::Message {
examples.pb.h: // @@protoc_insertion_point(class_scope:SearchResponse)
The language guide web-page provided an example(https://developers.google.com/protocol-buffers/docs/proto#services) which requires to use class of "SearchService": but in the generated code, there's no search service. The guide didn't provide a complete sample of RpcChannel/RpcController usages.
So how can I fix the example to make it work? I searched google but didn't find any good cpp example that gives a complete sample of how RpcChannel/RpcController could work. Any hints or links?
Thanks!