You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by "tsoliman@gmail.com" <ts...@gmail.com> on 2015/07/12 01:32:18 UTC

Kafka producer input file

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

RE: Kafka producer input file

Posted by Todd Snyder <ts...@blackberry.com>.
You can also checkout Klogger (https://github.com/blackberry/Klogger), which will take input from a TCP port or a file.

Todd.

-----Original Message-----
From: Jason Gustafson [mailto:jason@confluent.io] 
Sent: Monday, July 13, 2015 20:09
To: users@kafka.apache.org
Subject: Re: Kafka producer input file

There is also kafkacat (https://github.com/edenhill/kafkacat), which
exposes a few more knobs than the console producer.

-Jason

On Sat, Jul 11, 2015 at 6:40 PM, tsoliman@gmail.com <ts...@gmail.com>
wrote:

> Thank you, Shayne.
>
> On Sat, Jul 11, 2015 at 6:35 PM, Shayne S <sh...@gmail.com> wrote:
>
> > 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, tsoliman@gmail.com <ts...@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
> > >
> >
>

Re: Kafka producer input file

Posted by Jason Gustafson <ja...@confluent.io>.
There is also kafkacat (https://github.com/edenhill/kafkacat), which
exposes a few more knobs than the console producer.

-Jason

On Sat, Jul 11, 2015 at 6:40 PM, tsoliman@gmail.com <ts...@gmail.com>
wrote:

> Thank you, Shayne.
>
> On Sat, Jul 11, 2015 at 6:35 PM, Shayne S <sh...@gmail.com> wrote:
>
> > 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, tsoliman@gmail.com <ts...@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
> > >
> >
>

Re: Kafka producer input file

Posted by "tsoliman@gmail.com" <ts...@gmail.com>.
Thank you, Shayne.

On Sat, Jul 11, 2015 at 6:35 PM, Shayne S <sh...@gmail.com> wrote:

> 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, tsoliman@gmail.com <ts...@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
> >
>

Re: Kafka producer input file

Posted by Shayne S <sh...@gmail.com>.
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, tsoliman@gmail.com <ts...@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
>