grpc-python bidirectional streaming delivery status

39 views
Skip to first unread message

Sudharsan R

unread,
Aug 6, 2020, 9:27:50 PM8/6/20
to grpc.io
Hi all,
I must be missing something simple. I'm using the python client to generate RPC messages for a bidirectional streaming service. The server is in java and generates messages very rarely. How can i at a grpc level know if messages have been delivered to the business logic on the server side?

This is an example i see at many places:

response = stub.MetricReport(iter(repeated_metric()))

for r in response:

   //Do something with response


However, this seems to be a blocking call and like i said the server rarely responds. What can i look at from a grpc level to get delivery status?

Thanks
Sudharsan



Richard Belleville

unread,
Aug 12, 2020, 3:09:36 PM8/12/20
to grpc.io
gRPC does not handle application-level acknowledgement of receipt of messages. If you want to do this, you'll have to add it into your protocol. Your method might look something like this:


syntax = "proto3";

message MetricRequest {
  ...
}

message MetricResponse {
  oneof payload {
    google.protobuf.Empty ack = 1;
    ... // Whatever the original intended response was.
  }
}

service MultiGreeter {
    rpc MetricReport (MetricRequest) returns (stream MetricResponse) {}
}

Your server would then immediately acknowledge receipt of a client request by sending a MetricResponse with only the ack field set.

Thanks,
Richard

Sudharsan R

unread,
Aug 12, 2020, 3:39:35 PM8/12/20
to Richard Belleville, grpc.io
Thanks.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/e58be813-276e-4f09-bbc6-1927a446180bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages