Question about GRPC synchronous client side streaming

72 views
Skip to first unread message

Sidhartha Thota

unread,
Aug 19, 2021, 4:08:45 AM8/19/21
to grpc.io
Hi,

We have synchronous C++ streaming client (https://grpc.io/docs/what-is-grpc/core-concepts/#client-streaming-rpc) that streams messages to Java server. We open the ClientWriter once and use it for longer duration like 1 hour. In this one hour, clientwriter writes messages to server. We have a question here that if writer.Write() (https://grpc.github.io/grpc/cpp/classgrpc_1_1_client_writer.html#ae1005a55fd888d83854c6d0e1e0c148f) which returns boolean value (0 on failure and non-zero on success).

If `writer.Write()` returns non-zero, can we safely assume that server read that message at its end? if not, what does 0 and non-zero mean as return value of `writer.Write()`? 

If we cannot assume that `writer.Write()` successfully delivers message to server, how can we gurantee at client that server received message successfully with synchronous C++ streaming client ?

--
Thanks,
Sid.

Ivy Zhuang

unread,
Aug 25, 2021, 1:47:36 PM8/25/21
to grpc.io
I was more familiar with grpc-java. In java one way is to add a stream tracer, and the library would callback on your methods, e.g inboundHeaders(), you can add logs there to know client server receives the messages.

It looks c-core has the support as well
https://javadoc.io/static/io.grpc/grpc-core/1.16.1/io/grpc/ClientStreamTracer.html
Reply all
Reply to author
Forward
0 new messages