Hi Grpc team!
I have a ServerInterceptor instance for my grpc server, it does something like this:
@Override
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) {
Context context = Context.current();
.... // more code here
context = context.withValue(USER_ID, "my-user-id");
return Contexts.interceptCall(context, call, headers, next);
}
and in my service method I get access to the userId using smth like this:
USER_ID.get()
I have some questions:
Is this implementation correct?
Is this thread safe?
Is there any way to test that implementation?
Is there any documentation that I can check to understand how Threads are handled by the grpc server?
Thanks in advance! :)
Edu-