Last active
October 31, 2021 07:57
-
-
Save zabih-alipour/817964f76d64e06789ee166028cab985 to your computer and use it in GitHub Desktop.
Read file line by line and send to kafka topic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
cd /opt/bitnami/kafka/bin/ | |
input="/messages/data/messages.txt" | |
while IFS= read -r line | |
do | |
sh kafka-console-producer.sh --bootstrap-server 127.0.0.1:9092 --topic topic_name $line | |
done < "$input" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another way to do same thing:
kafka-console-producer.sh --bootstrap-server 127.0.0.1:9092 --topic topic_name < /messages/data/messages.txt