db80
db80

Reputation: 4427

Java, gRPC and Context propagation

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!

Upvotes: 5

Views: 3886

Answers (1)

Eric Anderson
Eric Anderson

Reputation: 26464

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.

Upvotes: 6

Related Questions