[英]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? 是否有人在使用Java中的gRPC的客户端(存根)和服务器之间传播io.grpc.Context?
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 . 在网上,我仅找到使用Header而不是Context的示例。
Thanks! 谢谢!
io.grpc.Context
is for local propagation only, like between threads or even on the same thread. io.grpc.Context
仅用于本地传播,例如在线程之间甚至在同一线程上。 gRPC purposefully does not propagate items from it automatically. gRPC不会有目的地自动传播其内容。 You can use a
ClientInterceptor
to copy a value from the Context
to the Metadata
. 您可以使用
ClientInterceptor
将值从Context
复制到Metadata
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.