Is it possible to have a client channel that automatically reconnects?
I tried using wait_for_ready(true)
on the context, but that doesn't seem to have any effect.
I get this crash when I try to use a client channel with a lost connection:
E0519 12:56:40.239405883 9379 client_context.cc:119] assertion failed: call_ == nullptr
A gRPC channel will reconnect automatically.
A gRPC channel uses a single HTTP/2 connection, and concurrent calls are multiplexed on that connection. When the number of active calls reaches the connection stream limit, additional calls are queued in the client. Queued calls wait for active calls to complete before they are sent.
Using the API Starting from a service definition in a . proto file, gRPC provides protocol buffer compiler plugins that generate client- and server-side code. gRPC users typically call these APIs on the client side and implement the corresponding API on the server side.
Rather than using a textual format such as JSON or XML, gRPC uses a protocol buffer–based binary protocol to communicate with gRPC services and clients. Also, gRPC implements protocol buffers on top of HTTP/2, which makes it even faster for inter-process communication.
My problem was attempting to re-use a context. Creating a new context for each attempt fixed the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With