Interface HeaderGetter<T,​C>

    • Method Detail

      • getFirstHeader

        @Nullable
        T getFirstHeader​(java.lang.String headerName,
                         C carrier)
      • forEach

        <S> void forEach​(java.lang.String headerName,
                         C carrier,
                         S state,
                         HeaderGetter.HeaderConsumer<T,​S> consumer)
        Calls the consumer for each header value with the given key until all entries have been processed or the action throws an exception.

        The third parameter lets callers pass in a stateful object to be modified with header values, so the HeaderGetter.HeaderConsumer implementation itself can be stateless and potentially reusable.

        Type Parameters:
        S - the type of the state object
        Parameters:
        headerName - the name of the header
        carrier - the object containing the headers
        state - the object to be passed as the second parameter to each invocation on the specified consumer
        consumer - the action to be performed for each header value