Class HeaderAttachingInterceptor<T>

  • Type Parameters:
    T - the key and value type of the header this interceptor will attach
    All Implemented Interfaces:
    io.grpc.ClientInterceptor

    public class HeaderAttachingInterceptor<T>
    extends Object
    implements io.grpc.ClientInterceptor
    Interceptor around a gRPC request to add header information as metadata to a message.
    Since:
    4.0
    Author:
    Marc Gathier
    • Constructor Detail

      • HeaderAttachingInterceptor

        public HeaderAttachingInterceptor​(io.grpc.Metadata.Key<T> header,
                                          T value)
        Constructs a HeaderAttachingInterceptor attaching metadata using the given header as key, paired with the given value
        Parameters:
        header - the Metadata.Key to attach on intercepted messages
        value - the object of type T to attach on intercepted messages
    • Method Detail

      • interceptCall

        public <REQ,​RESP> io.grpc.ClientCall<REQ,​RESP> interceptCall​(io.grpc.MethodDescriptor<REQ,​RESP> methodDescriptor,
                                                                                 io.grpc.CallOptions callOptions,
                                                                                 io.grpc.Channel channel)
        Specified by:
        interceptCall in interface io.grpc.ClientInterceptor