I have a bi-directional RPC, let's use the sample
StreamingGreeter.
I need to register a response observer:
// a response observer
StreamObserver<HelloReply> responseObserver = new StreamObserver<HelloReply>() { ... };
StreamingGreeterGrpc.StreamingGreeterStub stub = StreamingGreeterGrpc.newStub(channel);
// calling the streaming rpc returns the request observer
StreamObserver<HelloRequest> requestObserver = stub.SayHelloStreaming(responseObserver);
So, how do I safely use the request observer from within the response observer, given that the response observer has to be created before the rpc call and the request observer is only available after the rpc call?
In my example, upon receiving HelloReply, I might want to, for example trigger sending another HelloRequest (for whatever reason).