2
votes

Does anyone have a working example of io.grpc.Context propagation between client (stub) and server using gRPC in java?

My understanding is that it's not possible and I must use Metadata instead. Am I correct?

Online I have found only examples using Header rather than Context.

Thanks!

1

1 Answers

4
votes

io.grpc.Context is for local propagation only, like between threads or even on the same thread. gRPC purposefully does not propagate items from it automatically. You can use a ClientInterceptor to copy a value from the Context to the Metadata.