Java Serverside flow control with ServerCallStreamObserver

129 views
Skip to first unread message

dan....@rach.io

unread,
Oct 5, 2016, 4:07:17 PM10/5/16
to grpc.io
I am playing around with the experimental flow control functionality in ServerCallStreamObserver.
My goal is to wire up bi-directional calls into RxJava pipelines.  For the most part gRPC and Rx wire together easily.  If you are interested, my very initial setup is here: https://gist.github.com/oillio/75ffadfd44c30497a4e8cf6476eff438

I've got a couple questions on how flow control works.

From what I can see, the request-side flow control is actually managed through the passed in responseObserver object.
In order to take control, I should do something along the lines of:
((CallStreamObserver) responseObserver).disableAutoInboundFlowControl();

Then, I can request additional messages through:
((CallStreamObserver) responseObserver).request(1);

Is this the recommended way to do this?
Is there a way, or plans to provide a way, to manage flow control through the request StreamObserver returned by the application code handler?
This is a bit awkward for my use case as my request StreamObserver will need to keep a reference to the response StreamObserver in order to manage the request-side flow control.

bornet...@gmail.com

unread,
Feb 6, 2017, 4:25:43 AM2/6/17
to grpc.io, dan....@rach.io
Hi,

I'm also very interested in wiring gRPC to rxJava's Flowable to get non-blocking back-pressure . Did you manage to make it work ?
It should also be possible to do it on the client side. Did you have a look ?

Carl Mastrangelo

unread,
Feb 8, 2017, 12:44:46 PM2/8/17
to grpc.io, dan....@rach.io
Can you make a shared object between the two observers to control flow between the two?  That way they don't need a ref to each other?
Reply all
Reply to author
Forward
0 new messages