2
votes

How can I implement a strategy to detect and try to recover from network errors using gRPC-java? I know that UNAVAILABLE status can mean a network error, but that doesn't tell me what kind of network error it was - and UNAVAILABLE can also be sent back from the server.

In Java RMI we are admonished to pay attention to network problems and we can distinguish e.g. a ConnectionException which is a connection refused error. How can we do this with gRPC?

1

1 Answers

1
votes

You can know more details about the error from the cause and description of the Status. For example: if it is a connection error from client side, the cause probably will be an IO/SocketException; if it is a GO_AWAY sent from the server, the description will include the HTTP/2 error code.