I found similar definition in route_guide sample protobuf file, while the 
C++ implementation used sync api which is easy to understand. How could it 
be if we use async way?

在 2018年9月7日星期五 UTC+8下午12:15:39,[email protected]写道:
>
> 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.
> I learned the basic usage from the helloworld greeter_async_server.cc 
> <https://github.com/grpc/grpc/blob/master/examples/cpp/helloworld/greeter_async_server.cc>,
>  
> which defined
>     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.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/ba6ec63c-9c88-4bd0-964e-2982f41acbd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to