Interface Header


  • public interface Header
    A Header is a key-value pair, and multiple headers can be included with the key, value, and timestamp in each Kafka message. If the value contains schema information, then the header will have a non-null schema.

    This is an immutable interface.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String key()
      The header's key, which is not necessarily unique within the set of headers on a Kafka message.
      Header rename​(String key)
      Return a new Header object that has the same schema and value but with the supplied key.
      Schema schema()
      Return the Schema associated with this header, if there is one.
      Object value()
      Get the header's value as deserialized by Connect's header converter.
      Header with​(Schema schema, Object value)
      Return a new Header object that has the same key but with the supplied value.
    • Method Detail

      • key

        String key()
        The header's key, which is not necessarily unique within the set of headers on a Kafka message.
        Returns:
        the header's key; never null
      • schema

        Schema schema()
        Return the Schema associated with this header, if there is one. Not all headers will have schemas.
        Returns:
        the header's schema, or null if no schema is associated with this header
      • value

        Object value()
        Get the header's value as deserialized by Connect's header converter.
        Returns:
        the deserialized object representation of the header's value; may be null
      • with

        Header with​(Schema schema,
                    Object value)
        Return a new Header object that has the same key but with the supplied value.
        Parameters:
        schema - the schema for the new value; may be null
        value - the new value
        Returns:
        the new Header; never null
      • rename

        Header rename​(String key)
        Return a new Header object that has the same schema and value but with the supplied key.
        Parameters:
        key - the key for the new header; may not be null
        Returns:
        the new Header; never null