Beyhan Gül
Beyhan Gül

Reputation: 171

Apache Kafka producer read from file one time

I am new for Kafka. I have created a producer-topic-consumer. When i take data manuel it's not problem producer always open.

But when i try below code (to read from file)

 bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test  --new-producer < /home/beyhan/foo.txt

Read from file and return

WARN The configuration topic = null was supplied but isn't a known config. (org.apache.kafka.clients.producer.ProducerConfig)

and producer stop. I want to always open producer and when i add a new txt file should read always.How can i write a folder and when folder has new txt file read from producer.

Upvotes: 1

Views: 1580

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191711

Regarding the command used, that has worked fine for me, though --new-producer isn't necessary

i want to open txt file and always add this file or read always new files

In this case, I would suggest looking into Fluentd or Filebeat rather that writing some producer code.

If you want to use Kafka Connect, you can try kafka-connect-spooldir

Upvotes: 0

Related Questions