akka/akka-grpc

akka grpc server stream cannot return every result in real time

wayddmldbzz opened this issue · 2 comments

First of all, I have a server stream method. In the method, I will request an actor in a loop. I expect that after each request is responded, the application will return the result to the caller. But no, I found that it still waits for all responses to be completed before returning, is this normal?

// The code is as follows, for the convenience of observing the results, I added sleep
override def itKeepsReplying(in: HelloRequest): Source[HelloReply, NotUsed] = {
    Source(1 to 10).map(index => {
        Thread.sleep(5000)
        HelloReply(index)
    })
}

In order to confirm whether grpc itself supports, I tried java's implementation of this piece
If you want to send data to the caller:responseObserver.onNext(responseBuilder.build());
If you want to end this call: responseObserver.onCompleted();
Data is sent to the caller every time onNext is called

So my question is:
Is my assumption correct? Can akka-grpc do it
If it can be done, please give an example

Hi @wayddmldbzz, we use the issue trackers for tracking bugs and feature requests, please use the forums over at https://discuss.akka.io for questions like this.

Thanks, I've gone there to ask questions