Hi, resurrecting this old thread.
I am a bit puzzled that this boilerplate code is not auto-generated (or there is no option for it) and wondering what is the reason behind it? There can be different patterns to generate this boilerplate but at least one could be provided by default. Is async api usage not that common (it is certainly more usable for me as it allows a finer control of the threading model) or more precisely, is async api usage with many services with many rpcs not that common? Thanks. On Friday, September 23, 2016 at 9:04:32 AM UTC-7, Sree Kuchibhotla wrote: > > Yes. You would need a different 'tag' to pass to each's methods > *YourServiceName*::AsyncService::Request*YourMethodName*() call (so that > when CompletionQueue::Next() returns a tag, you can know which method you > just received a call for). > > So if a service as more than one method, creating one CallData per method > sounds good. > > Or more accurately, if you have multiple *YourServiceName* > ::AsyncService::Request*YourMethodName*() calls in parallel, then you > should make sure each of those calls have different tags so that when > CompletionQueue::Next() returns a tag, you know which of your > *YourServiceName*::AsyncService::Request*YourMethodName*() 's tag it is. > > Hope this helps, > Sree > > > On Fri, Sep 23, 2016 at 8:41 AM, Christian Rivasseau <[email protected] > <javascript:>> wrote: > >> So for a service that would have more than one method, I would create a >> new CallData() for each method >> is that correct? >> >> >> >> On Fri, Sep 23, 2016 at 5:22 PM, 'Sree Kuchibhotla' via grpc.io < >> [email protected] <javascript:>> wrote: >> >>> Hi Christian, >>> I am assuming you are talking about the Greeter async server >>> <https://github.com/grpc/grpc/blob/master/examples/cpp/helloworld/greeter_async_server.cc> >>> >>> in the examples. In this case the 'CallData' struct is not a gRPC >>> structure. It is an application defined structure passed as a 'tag' to >>> *YourServiceName*::AsyncService::Request*Y**ourMethodName(...)* and S >>> erverAsyncResponseWriter<T>::Finish(...) functions. >>> >>> >>> // If the server receives a request for SayHello() function >>> >>> // the next call to cq_->Next() will return the tag (in this case >>> >>> // the CallData object passed) >>> >>> service_->RequestSayHello(&ctx_, &request_, &responder_, cq_, cq_, >>> *this*); >>> >>> // Once the operation Finish() is actually complete, the tag >>> >>> // (in this case, the CallData object again) is returned via the >>> >>> // call to cq_->Next() >>> >>> responder_.Finish(reply_, Status::OK, *this*); >>> >>> We do not have plans to generate these CallData structures. >>> >>> Hope this helps >>> Sree >>> >>> On Fri, Sep 23, 2016 at 6:31 AM, <[email protected] <javascript:>> wrote: >>> >>>> Hello, >>>> >>>> From reading the C++ example for async server, it seems that one has to >>>> write a CallData class for every >>>> service and every method? >>>> >>>> Are there any plans for the compiler to generate those CallData >>>> boilerplates? >>>> >>>> -- >>>> 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] <javascript:>. >>>> To post to this group, send email to [email protected] >>>> <javascript:>. >>>> 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/23678b27-c97f-4fc7-8239-aa9b67f1bc21%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/grpc-io/23678b27-c97f-4fc7-8239-aa9b67f1bc21%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> 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] <javascript:>. >>> To post to this group, send email to [email protected] >>> <javascript:>. >>> 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/CALRi9Qe4duy671_sVSU%2BJCTznx2-W1YCqCGkYrx_%3DnX8zk1zzw%40mail.gmail.com >>> >>> <https://groups.google.com/d/msgid/grpc-io/CALRi9Qe4duy671_sVSU%2BJCTznx2-W1YCqCGkYrx_%3DnX8zk1zzw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Christian Rivasseau >> Co-founder and CTO @ Lefty <http://www.lefty.io> >> +33 6 67 35 26 74 >> > > -- 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/2d469932-18ff-474f-947f-4dbeeb2b45d4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
