can put the service instances on different ports?
i want to create gRPC server in python with client in java , and start up multiple service instances on different ports, can it work ? and the client how to support different ports ?
Generally we would expect you to run multiple services on the same port, as long as they are in the same process. But yes, there is an issue with python: grpc/grpc#4418.
For dealing with multiple ports in Java, instead of doing:
ManagedChannelBuilder.forTarget("somehost")
Just do:
ManagedChannelBuilder.forTarget("somehost:1234")
Where 1234 is the appropriate port number you want to connect to.
Oh, so great , but the ManagedChannelBuilder.forTarget is a ExperimentalApi, temporarily can't use ?
Oh, you're right, it is still experimental. Honestly, that particular API is unlike to change much. But there is also ManagedChannelBuilder.forAddress(String name, int port) which is stable.
ok, thank you very much