I do know this seems weird. Here is the sample definition of protobuf:
service Sample {
rpc Get (GetRequest) returns (GetResponse) {}
rpc Set (SetRequest) returns (SetResponse) {}
}
message GetRequest{...}
message GetResponse{...}
message SetRequest{...}
message SetResponse{...}
What I'm doing is to implement these services on the server end using async api.
HelloRequest request_;
HelloReply reply_;
And call RequestSayHello using the ONLY request and reply required in the ONLY rpc call
service_->RequestSayHello(&ctx_, &request_, &responder_, cq_, cq_, this);
I guess I might try to define all the messages in my "CallData" class like
class SampleCallData{
public:
...
private:
GetRequest gRequest;
GetResponse gRsp;
SetRequest sRequest;
SetResponse sRsp;
}
I'm not sure if my question is clear enough.
Here is what I wonder:
1. Will this kind of implementation work?(To implement all the rpc call defined in protobuf file)
2. Is there another way to do better?(I know I can define multi services)
3. If this will work, how does grpc bind the indeed request and response with rpc call?(In details, in the handleRpc() func, new SampleCallData() is called while it won't pass any value of request)
New to here, thanks a lot.