Closed btlines closed 6 years ago
I had a go with the async handlers and it doesn't play nice with the graph stage initialisation.
The grpc callbacks(beforeStart
or onReadyHandler
) seem to be called before the stage is fully initialised which gives the following error:
java.lang.IllegalStateException: not yet initialized: only setHandler is allowed in GraphStageLogic constructor
grpc-java seems to go with request(1)
when auto flow control is on:
Regarding: "java.lang.IllegalStateException: not yet initialized: only setHandler ..."
You have to call things in preStart()
of the GraphStage, then things are ready
grpc-java provides a way to manage back pressure by manually controlling the flow. This is done by disabling the automatic flow control and then checking that the observer can accept more elements by calling
isReady
before callingonNext
. If the observer is not ready the registeredonReady
handler will be invoke when the observer is able to accept more elements. On the other handrequest
allows to ask the producer to send more elements.This PR is a first stab at wiring the grpc-java back-pressure mechanism into akka-streams.