Versions Compared

Key

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

Table of Contents

Status

Current state: Under discussion Accepted

Discussion thread: here

Voting thread: here

JIRA: KAFKA-6733

PR: #8909 #9099 (based on #4807)

Motivation

...

  • print.timestamp
  • print.key
  • print.value
  • print.partition
  • key.separator
  • line.separator
  • key.deserializer
  • value.deserializer

...

Code Block
$ kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning --property print.partition=true --property print.key=true --property print.timestamp=true --property print.offset=true --property print.headers=true --property key.separator='|'

CreateTime:1592475472398|key1Partition:0|Offset:3|0|h1=:v1,h2=:v2|value1    <-- offset 3, partition 0key1|value1
CreateTime:1592475472456|key2Partition:0|Offset:4|0|NO_HEADERS|value2     <-- offset 4, partition 0key2|value2



Proposed Changes

Add new properties to DefaultMessageFormatter as per the above:

...

Compatibility, Deprecation, and Migration Plan

KIP-431 introduces incompatibility when "print.partition=true" (this property exists in the code before KIP-431 but not documented). Before KIP-431, "kafka-console-consumer" prints the partition as a number after the value for example: "key1|value1|0". After this KIP, "kafka-console-consumer" prints the partition number prefixed with "Partition:" before the key (if printed) and value, for example: "Partition:0|key1|value1" . Because this property was not documented, no migration plan is implemented in KIP-431.

The other changes are backward compatible . If a user won’t because they do not exist before. Apart from "print.partition=true", if a user does not use any new parameters, then the output of console consumer will look the same as before.

...