Sorry for the late reply. We are actually using a bidirectional stream observer. Here is a model implementation of stream observer.
Multiple clients can be connected to the server. Clients send chunks of data(16MB chunks) to server for processing.
ClientRequestObserver#onNext() {
// add the request to pending queue.
// if the queue is full the request is rejected and client retries after some time. These rejected requests lead to lots of garbage in the system because the requests are larger in size.
}
In the background there is a service running which polls the pending requests queue and processes them. The requirement was to be able to control the client flow of requests based on the pending request queue size.