Check out the example I added at https://groups.google.com/forum/#!topic/grpc-io/T9u2TejYVTc
As for 300-400 rpcs, you can write a custom code generator that plugs in to ProtoC (much like grpc_cpp_plugin) and have it generate additional code that you may need (like auto "requesting" your server to enable these rpcs at the start up). I have similar sort of set up. I did not write the code generator plugin I suggest here because my application already had one (grpc support was an addition). On Friday, March 16, 2018 at 3:13:02 AM UTC-7, [email protected] wrote: > > My team is designing a scalable solution with micro-services architecture > and planning to use gRPC as the transport communication between layers. And > we've decided to use async grpc model. The design that example( > greeter_async_server.cc > <https://github.com/grpc/grpc/blob/master/examples/cpp/helloworld/greeter_async_server.cc>) > > provides doesn't seem viable if I scale the number of RPC methods, because > then I'll have to create a new class for every RPC method, and create their > objects in `HandleRpcs()` like this Pastebin > <https://pastebin.com/PSJs3sqV> (complete code). > > > void HandleRpcs() { > new CallDataForRPC1(&service_, cq_.get()); > new CallDataForRPC2(&service_, cq_.get()); > new CallDataForRPC3(&service, cq_.get()); > // so on... > } > > > > It'll be hard-coded, all the flexibility will be lost. > > I've around 300-400RPC methods to implement and having 300-400 classes > will be cumbersome and inefficient when I'll have to handle >100K RPC > requests/sec and this solution is a very bad design. I can't bear the > overhead of creation of objects this way on every single request. Can > somebody kindly provide me a workaround for this. Can async grpc c++ not be > simple like its sync companion? > > TIA > -- 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/fe4607d9-1606-461d-a7a4-de79ee259a76%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
