gRPC-java: What's the best way to handle io.grpc.StatusRuntimeException: UNAVAILABLE

29 views
Skip to first unread message

Ankit Bansal

unread,
Sep 5, 2019, 2:23:29 AM9/5/19
to grpc.io
Hi Guys,

Can a grpc client wait/block till grpc-server serving the RPC becomes available? I mean if gRPC client specifies a host:port pair ( gRPC server ) to connect to and for some reason gRPC server was not available immediately, can the client wait for it to become available?

In my setup, I keep getting io.grpc.StatusRuntimeException: UNAVAILABLE error due to grpc-server side taking time to come up and client tries to connect before it could come up.

I am using a NettyChannelBuilder to build the channel and passing this channel to create a blocking stub which is used to make RPC calls.
gRPC library versions for JARs that i am using is 1.7.0

Thanks,
Ankit Kumar

Penn (Dapeng) Zhang

unread,
Sep 13, 2019, 5:54:21 PM9/13/19
to grpc.io
You can enable withWaitForReady in your client stub. Then the rpc will wait until server is up.
Reply all
Reply to author
Forward
0 new messages