how to flush messages on server

21 views
Skip to first unread message

matt.m...@lucidworks.com

unread,
Dec 28, 2017, 8:05:48 PM12/28/17
to grpc.io
Hi,

I have an application which receives messages from a client on a bidirectional channel. There’s a case where I’d quickly stop processing messages on the server’s StreamObserver (after I’ve told the client to stop also), but I’m not sure of what’s actually happening to the already recieved messages in gRPC? I’m assuming they are sitting in some Netty queue. Is there a way to throw out those messages, or am I stuck just processing them all anyway? If the latter is the only way, can I somehow control the queue size so it doesn’t take a potentially long time to run through them all?

Thanks,
- Matt

Carl Mastrangelo

unread,
Jan 4, 2018, 7:19:00 PM1/4/18
to grpc.io
You should cast from the StreamObserver to a CallStreamObserver and only send messages when isReady() is true.  You can wait for it to become true by setting an isReady handler (look in that class for the exact method name). 

matt.m...@lucidworks.com

unread,
Jan 7, 2018, 2:16:25 PM1/7/18
to grpc.io
OK that makes sense. Thanks

- Matt
Reply all
Reply to author
Forward
0 new messages