The console producer will read from STDIN. Assuming you are using 0.8.2, you can pipe the file right in like this:
kafka-console-produce.sh --broker-list localhost:9092 --topic my_topic --new-producer < my_file.txt On Sat, Jul 11, 2015 at 6:32 PM, tsoli...@gmail.com <tsoli...@gmail.com> wrote: > Hello, I am trying to setup a Kafka producer to take input from a file > instead of standard input. According to Kafka documentation > <https://kafka.apache.org/documentation.html>: > > Kafka comes with a command line client that will take input from a file or > > from standard input and send it out as messages to the Kafka cluster. > > > I could not seem to find any documentation on how the the command line > client can read from a file. Could you please help? > > Thanks, > Tim >