Hello gRPC team, my name is Ivan and I am currently working on a project
that involves gRPC for client to server communication. So far everything is
going well and we are glad that choose gRPC, thumbs up for your good work.

Lately I found myself in the following situation and i was hoping you can
show me the right way forwards. Initially my services were supposed to only
support unary calls and I wanted to create a mechanism that validates the
messages before they reach the service logic. That's why I thought using
interceptors will solve my problem. I created interceptor that returns new
ForwardingServerCallListener and I overrided the onMessage method so in
there I validate the incoming message and if it has malformed data, I
simply call call.sendHeaders, call.sendMessage and call.close to cancel the
call and return it to the sender. One other feature that this interceptor
has is, in case of validation failure the delegate() method of the
ForwardingServerCallListener returns empty(no operation) Listener, so no
further propagation of the servercall is made.
For unary calls this so far works as intended, but now I need to support
streaming as well, and this approach does not seems to work. If a couple of
messages are being sent over the stream and a malformed one comes, sending
the headers breaks the server to client stream. And in general i feel for
streaming this is not the right approach. Can you point me to a solution
for this problem, validating the incoming messages over a stream with the
option of canceling a message if it is bad and doing so in interceptor?

Cheers,
Ivan.

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAJLe047QKUgivE%2Bvi0gMtBe3ev2a%3DdN5xHC0y4TiL0%2B-mQH-NQ%40mail.gmail.com.

Reply via email to