Search code examples
grpcgrpc-javagrpc-web

how request local gRPC server?


I have a gRPC server, and I want to call this server by local channel like:

other message -> adapter -> local grpc client -> local grpc server

so how to create a local grpc client?, use local channel to build stub?


Solution

  • Two options:

    1. also start your services with the InProcessServerBuilder, and use the InProcessChannelBuilder to communicate with it, or
    2. just contact the server over "localhost"