Im currently running a gRPC server with a reflection service as well to expose my services.
Server server = ServerBuilder.forPort(9092)
.addService(ProtoReflectionService.newInstance())
.addService(new StructServiceImpl())
.addService(new ChatServiceImpl()).build();
server.start();
Here, both my StructService
and ChatService
are exposed via reflection. I need to know whether there is a way to reflect only the ChatService
and do not expose the StructService
to the external parties?
At the moment ProtoReflectionService
does not support this functionality. While not ideal, one thing you could do is running StructServiceImpl
in a separate server:
Server structSerivceServer = ServerBuilder.forPort(9093)
.addService(ProtoReflectionService.newInstance())
.addService(new StructServiceImpl())
.build();
structSerivceServer.start();
Server server = ServerBuilder.forPort(9092)
.addService(new ChatServiceImpl())
.build();
server.start();
Feel free to file a feature request at grpc-java GitHub.