Understanding: Server Side StreamObserver Callback Object

143 views
Skip to first unread message

vivek Akupatni

unread,
Jul 7, 2021, 10:19:38 PM7/7/21
to grpc.io
Hi all

I am new to grpc and trying to understand the following example: https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/routeguide/RouteGuideServer.java#L174

Server on receiving a request, returns a `StreamObserver` callback object. I understand that this callback object is not thread-safe and have couple of questions regarding how this object is handled.

  1. If a client streams 3 messages (m1, m2, & m3) within a single recordRoute rpc call, does rpc server implementation ensure that `onNext` method is only called after previous onNext method finishes execution (assuming this is not the first message)?
  2.  Essentially, at any point of time, would only one thread from grpc worker-pool would be accessing StreamObserver callback object?
  3.  If m1 onNext takes 10 seconds to process, would m2 message would be hanging around in server queue for 10 seconds.

Regards
Vivek







Reply all
Reply to author
Forward
0 new messages