Add gRPC servicers during runtime and provide interface to client

Viewed 617

I am currently working on a project where I want to be able to add functionality to the gRPC server during runtime.

Once added, I want the client to be able to access the newly added functionality. I have two different ideas on how to approach this problem:

  1. Transfer a generated gRPC file via another interface to the client and use it from there.
  2. Using the Reflections Framework provided by Google (Python gRPC Reflections) to retrieve the available methods and interfaces.

Now I was wondering what the correct way to approach this problem is and am interested if there have already been solutions to it.

1 Answers

An object that implements grpc.GenericRpcHandler interface, which contains a service method, can be registered on a gRPC server. The service method then can resolve and return an arbitrary RpcMethodHandler based on the method name. You can customize that service method to dynamically return the appropriate handler at runtime.

Related