I would like to make use of the Kafka headers feature. When producing events I would set a header. Then on consumption I would read the header and make a decision based on that header content.
See KIP: https://cwiki.apache.org/confluence/display/KAFKA/KIP-82+-+Add+Record+Headers
My question is, can I read the header at the consumer without de-serializing the event?
Thanks.
As far as I know it's not possible. At protocol level, the headers are part of the records_set of a FetchResponse and it needs to be deserialized as well as the payload of the message itself. From a Java Client API point of view anyway you don't have a way to access directly the raw bytes.