io.grpc.Status vs com.google.rpc.Status

Please note that the two Status classes cover different errors.

io.grpc.Status represents the success or failure of a call at a service level: a failure stems from an invalid argument, hitting an overloaded endpoint, and so on.

In the specific context of the command completion service, com.google.rpc.Status is the code generated for the Protobuf message that describes whether a command was executed successfully or not, and for what reason.

To make a specific example, you can make a call to the completion service that returns successfully (io.grpc.Status) and get a stream of completed commands, which can either have succeeded or failed (com.google.rpc.Status).

I would not try to convert between those two classes but use each at the relevant layer to address failures: you can for example have a retry strategy for calls that fail because of back-pressure on the Ledger API (io.grpc.Status) and a separate one to retry to issue specific commands that may have failed (com.google.rpc.Status).

4 Likes