You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.

Status

Current stateUnder Discussion

Discussion thread: here

JIRA: here 

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

We want to introduce --files to the producer command line tool to support reading data from a given multi-file,
Multiple files are separated by --files-separator, the default comma is the separator.

Public Interfaces

kafka-console-producer.sh:
The producer command will accept  --files  and --files-separator options.
Implement FileMessageReader for the MessageReader interface,The original LineMessageReader will still be the default reader.
When the --files option is used, it will switch to FileMessageReader.


E.g
1.The content in the 1.txt file is:
a
b
c

2.The content in the 2.txt file is:
1
2
3

3.Execute producer command line tool:
./bin/kafka-console-producer.sh --bootstrap-server `hostname`:9092 --topic test-01 --files 1.txt,2.txt

4.Execute consumer command line tool:
./bin/kafka-console-consumer.sh --bootstrap-server `hostname`:9092 --topic test-01 --from-beginning
console output:
a
b
c
1
2
3

Proposed Changes


Compatibility, Deprecation, and Migration Plan

The new options have no effect on existing usage.

Rejected Alternatives

None

  • No labels