Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current state: ApprovedUnder Discussion

Discussion thread: ... here

Voting thread:... here

JIRA: KAFKA-13351

PR: #11456

...

Currently it is not possible to add headers to records when using the kafka-console-producer. The kafka-console-producer is an important debugging tool: The possibility to add headers to a record will improve the debugging experience.

Public Interfaces

New properties to LineMessageReader

...

when parse.headers=true and parse.key=true:
"h1:v1,h2...\tkey\tvalue"

when parse.headers=true and parse.key=false:
"h1:v1,h2...\tvalue"

when parse.headers=false and parse.key=true:
"key\tvalue"

when parse.headers=true false and parse.key=false :
"h1:v1,h2...\tvaluevalue"


Code Block
$ ./bin/kafka-console-producer.sh --bootstrap-server localhost:29092 --topic test --property parse.key=true --property parse.headers=true
>h0:v0,h1:v1 key value

...

Add new properties to ConsoleProducer.LineMessageReader as per the above:

  • parse.headerheaders
  • headers.delimiter
  • headers.separator
  • headers.key.separator

...

  • What impact (if any) will there be on existing users?

    The change is backward compatible. Current users of the kafka-console-producer can use it as they always did so far.


  • If we are changing behavior how will we phase out the older behavior?

    Not applicable.

...