On 2021/09/13 14:18:21, "David Li" <lidav...@apache.org> wrote: 
> Hello,
> 
> For this, you will have to depend on the fact that Flight is currently 
> implemented with gRPC. This means:
>  1. Take a dependency on flight-grpc,
>  2. Configure a plain gRPC server following the grpc-java docs,
>  3. Add the Flight service to the gRPC server via FlightGrpcUtils[1]
> Then you can get the peer address from grpc-java by installing a gRPC 
> interceptor that reads the address and places it in the gRPC context. From 
> within the FlightProducer, you can then access the gRPC context. This is 
> described briefly at [2] and you can see a short (incomplete) code snippet at 
> [3].
> 
> Maybe Flight could pull this info for you, this was done for C++/Python at 
> [4] - though it would be an opaque/transport-dependent string.
> 
> [1]: 
> https://arrow.apache.org/docs/java/reference/org/apache/arrow/flight/FlightGrpcUtils.html#createFlightService-org.apache.arrow.memory.BufferAllocator-org.apache.arrow.flight.FlightProducer-org.apache.arrow.flight.auth.ServerAuthHandler-java.util.concurrent.ExecutorService-
> [2]: https://stackoverflow.com/a/52633506
> [3]: https://github.com/grpc/grpc-java/issues/5489
> [4]: https://issues.apache.org/jira/browse/ARROW-9175
> 
> Best,
> David
> 
I have done most of those steps, but i missed the way to access the ip from the 
FlightProducer RPCs context, Context is empty, I need to attach the ip with 
each call context

Reply via email to