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]> 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]> 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]> 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]. >>> 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/ms >>> gid/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]. >> 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/ms >> gid/grpc-io/CALRi9Qe4duy671_sVSU%2BJCTznx2-W1YCqCGkYrx_%3DnX >> 8zk1zzw%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/CALRi9QfJ1sedzZAbB22_ZafWoY4-%3DE2auQs68FWOOx0MnWU9ag%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
