deepakjois commented :
This is a valid suggestion. For completeness sake, I want to also link the grpc-java HelloWorld client (which was mentioned on Slack when this was being discussed): grpc-java/HelloWorldClient.java at master · grpc/grpc-java · GitHub
There is one awkward bit that makes this a bit tricky. the
clients field is of type
DgraphGrpc.DgraphBlockingStub, which has a public
getChannel() method. However, the return type of
getChannel() is class
Channel and not
Channel does not have a
shutdown() method associated with it.
We have two options:
Channel type returned to
ManagedChannel and then call
shutdown() on it. This will work for existing clients, but its a bit hacky and inflexible.
We can make this abstraction cleaner, by using our own type for the
clients field (maybe something like
DgraphGrpcClientPool, which wraps around a list of
DgraphGrpc.DgraphBlockingStub objects. This would mean a breaking change, however.
Let me think a little bit more about this and implement something.