Versions Compared

Key

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

Table of Contents

Status

Current state: Under Discussion

Discussion thread: here

Status
colourGreen
titleAccepted
(4x+1 binding, 1x+1 non-binding)

Discussion thread: here

Vote thread: here

JIRA

Jira
serverASF JIRA
columnIdsissuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyKAFKA-14146

Pull Request: hereJIRA:

Motivation

Tools kafka-console-producer.sh and kafka-console-consumer.sh have the multiple option --property to setup the MessageReader for Producer (defined by --line-reader) or the MessageFormatter for Consumer (defined by --formatter).

...

The idea is to offer the same possibility to use a config file option to setup the MessageReader/MessageFormatterin addition to the existing option --property.

It will be useful in different use cases:

...

  • Before (multiple --property options):

    Code Block
    languagebash
    kafka-console-producer.sh [...] --property print.timestamp=true \ 
      --property print.key=true \
      --property print.offset=true \ 
      --property print.partition=true \ 
      --property print.headers=true \ 
      --property print.value=true \ 
      --property key.separator=':' \ 
      --property line.separator=';' \ 
      --property headers.separator='|'


  • After (all properties in one file):

    Code Block
    languageapplescriptactionscript3
    titlereader-config.properties
    print.timestamp=true
    print.key=true
    print.offset=true
    print.partition=true
    print.headers=true
    print.value=true
    key.separator=:
    line.separator=;
    headers.separator=|


    Code Block
    languagebash
    kafka-console-producer.sh [...] --reader-config reader-config.properties  


...

When a property is in the config file and as option, option wins.

Code Block
languageapplescriptactionscript3
titlereader-config.properties
print.timestamp=true
print.key=true
print.offset=true
print.partition=true
print.headers=true
print.value=true
key.separator=:
line.separator=;
headers.separator=|

...

Implement the new options as described in Public Interfaces section:

  • ConsoleProducer: new option "reader-config" with description "Config properties file for the message reader. Note that --property takes precedence over this config."
  • ConsoleConsumer: new option "formatter-config" with description "Config properties file to initialize the message formatter. Note that --property takes precedence over this config."

Already implemented in pull request #12175.

...