Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

back pressure: ResponseObserver & StreamController#437

Merged
garrettjonesgoogle merged 11 commits intogoogleapis:masterfrom
igorbernstein2:ssc-2-backpressure
Dec 6, 2017
Merged

back pressure: ResponseObserver & StreamController#437
garrettjonesgoogle merged 11 commits intogoogleapis:masterfrom
igorbernstein2:ssc-2-backpressure

Conversation

@igorbernstein2
Copy link
Copy Markdown
Contributor

@igorbernstein2 igorbernstein2 commented Nov 30, 2017

Introduces back pressure to gax's ServerStreamingCallables. This is part of #433

ApiStreamObserver gets upgraded to a ResponseObserver, which on stream start receives a StreamController. The StreamController allows the ResponseObserver to manually control flow. This inspired by reactive streams's api and grpc's ClientResponseObserver#beforeStart api:
https://github.com/grpc/grpc-java/blob/master/stub/src/main/java/io/grpc/stub/ClientResponseObserver.java#L44

This api enables interoperability with other frameworks like RxJava & Akka and more importantly, allows for iterator style streams to be implemented on top of gax. This will, in turn, allow us to compose ServerStreamingCallables via call(Request, ResponseObserver, Context) chaining.

The external api is backwards compatible, but will break subclasses of ServerStreamCallable

Next PRs:

  • implement the Iterable api: fa30cac
  • add a utility for reframing message streams: fdc444e

Loading
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants