salesforce/reactive-grpc

In ManyToOne and ManyToMany, remote method is called before the client subscribe

JooKS-me opened this issue · 0 comments

Hi folks, I found a problem when I use it like below.

stub = xxx.newReactorStub(channel);
stub.manyToMany(Flux.range(1, 10).map(i -> Message.newBuilder().setNumber(i).build())
                .doOnNext(System.out::println));

When I did not subscribe, the client terminal printed out the data, and the server side also showed that the data was received. Is this a bug? Or are there any other considerations?

Maybe we should add a doOnSubscribe after Flux.from(xxx) and defer delegate.apply until it is subscribed?

delegate.apply(observerAndPublisher);
return Flux.from(observerAndPublisher);