I am not sure I understand what you are trying to do. Are you trying to 
create a proxy? A proxy wouldn't need server interceptor. Instead, you can 
use a dynamic fallback handler registery 
<https://github.com/grpc/grpc-java/blob/v1.8.0/core/src/main/java/io/grpc/ServerBuilder.java#L140>.
 
It can handle RPCs for arbitrary method names, and you can do the 
forwarding there.

On Friday, December 8, 2017 at 6:26:51 AM UTC-8, [email protected] 
wrote:
>
> Hi,
>
> I'm trying to find examples for how I can achieve a conditional forwarding 
> interceptor, on the server. My gRPC instances can have stateful information 
> attached to them (stored in Zookeeper), mainly the ID of a Job currently 
> running on a node. I can get a node's host/port based on the Job ID from a 
> little service discovery utility ("getAddressByJobId(jobId)" etc.), and so 
> I'd like requests for getting a Job's status to be routed to the correct 
> node based on the requested Job ID. If there is no node hosting the Job, 
> then I don't want any forwarding at all, and instead just call the current 
> node's "getJobStatus" method. In the case where the interceptor does 
> forward, I can set a "forwarded" header so that when the correct node does 
> get the request, the interceptor won't continue to forward/redirect.
>
> I can get simple interceptor examples to work fine - but am struggling to 
> get this specific flow to work. Anyone have something like this available? 
> If not, could someone be kind enough to show an example of how I might do 
> this?
>
> Thanks,
> - Matt
>

-- 
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/4ff788e0-59a9-4626-b329-42caa02edeaa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to