dynamic registration of service in grpc server

1,652 views
Skip to first unread message

Chaitanya Gangwar

unread,
Feb 22, 2016, 4:10:53 AM2/22/16
to grpc.io
Hi,

Is it possible to register services dynamically with grpc server. I want grpc server up and running and whenever there is a new service, can it be registered with this server. is this possible ??

Thanks
Chaitanya

Abhishek Kumar

unread,
Feb 22, 2016, 9:40:19 AM2/22/16
to Chaitanya Gangwar, grp...@googlegroups.com

In C++ you can register a " generic" service which then allows you to do dynamic dispatch in the handler. i.e., with generic services you can implement your own dynamic registry above the grpc API.

-Abhishek

Chaitanya Gangwar

unread,
Feb 22, 2016, 10:11:19 AM2/22/16
to grpc.io, chaitany...@gmail.com
Hi Abhishek,

Thanks for your reply but could you please provide me little more help regarding the generic services. Could you please explain the design little more. I am new to this and have limited knowledge.
Also, is it possible to call "RegisterService"   api  after calling "buildAndStartServer" api.  I mean, if server is build and started, is it possible to register new services on the same server.

Thanks
Chaitanya

Yang Gao

unread,
Feb 22, 2016, 3:41:27 PM2/22/16
to Chaitanya Gangwar, grpc.io
The generic service is lower level C++ API. It provides the raw rpc data to user to do custom handling and is suitable for applications such as a proxy. 

Typically you want to have some dispatcher to send the rpc to its handler according to its method name. You can do your new service (handler) registration at the dispatcher.

You can take a look at generic_end2end_test.cc for a toy example.

You should not call RegisterService after starting the server.

--
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 grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/1de960e3-1a8f-4678-9493-762d8e2648b0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages