Skip to content

Instantly share code, notes, and snippets.

@kzltp
Last active August 21, 2020 09:34
Show Gist options
  • Select an option

  • Save kzltp/144d94ab2c395b752c7dd54d7051f638 to your computer and use it in GitHub Desktop.

Select an option

Save kzltp/144d94ab2c395b752c7dd54d7051f638 to your computer and use it in GitHub Desktop.
Kafka Random Send Message Script
#!/bin/sh
WORDFILE="/usr/share/dict/words"
messcounst=0
while true
do
date=$(date +"%Y-%m-%d_%H-%M-%S")
messcounst=`expr $messcounst + 1`
word=$(shuf -n1 /usr/share/dict/words)
echo "$date Arif'in mesaji random word P1 - $messcounst : $word" | /opt/kafka/bin/kafka-console-producer.sh --broker-list [KAFKAHOST]:9092 --topic ArifTestTopic > /dev/null
sleep 15
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment