Thanks everyone. We ended up going with the last suggestion, which was to 
have this all be handled in a service. Working great.

And btw, we're also using the Proxy you created, Eric. Slightly different 
use case for us (no need to inspect the metadata) and is working great. Do 
you plan on having this go into gRPC eventually?

Thanks,
Matt

On Friday, December 15, 2017 at 11:00:58 AM UTC-5, Eric Anderson wrote:
>
> On Fri, Dec 8, 2017 at 6:26 AM, <[email protected] <javascript:>> 
> wrote:
>
>> I'm trying to find examples for how I can achieve a conditional 
>> forwarding interceptor, on the server.
>>
>
> The conditional aspect of an interceptor should be trivial, as you should 
> just use an if in your interceptor.
>
> "Forwarding" here sounds like you want to forward to another server (vs 
> forwarding in-process to a different object). In general, this case seems 
> simple enough you should just write the code as a normal service, and have 
> the service issue a gRPC request to the correct backend. No fancy business, 
> other than propagating the "no forwarding" bit to your service via 
> Contexts.interceptCall(...).
>
> The only time I'd have expected to use an interceptor here is if you were 
> wanting to do this logic on client-side using a client interceptor.
>
> I did write the beginnings of an example 
> <https://github.com/ejona86/grpc-java/commit/29728aeb003ced3c190197c176563643be22bef1>
>  
> (it's not merged, but functional) that does "forwarding" in the proxy 
> sense. But it wouldn't be easy to use in your case since you want to 
> parse/process the request message to determine where to forward to. Generic 
> proxies would tend to use only Metadata for routing. Service-specific 
> proxies should generally just write a service that behaves how they want.
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/4577c738-5a07-4470-98fe-d2e7a97ccf1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to