Skip to content

Instantly share code, notes, and snippets.

@owahab
Created April 26, 2018 07:58
Show Gist options
  • Save owahab/9f081ec7938f51427cf84ba2aa9628f4 to your computer and use it in GitHub Desktop.
Save owahab/9f081ec7938f51427cf84ba2aa9628f4 to your computer and use it in GitHub Desktop.
Send dummy messages to a Kafka topic using Kafkacat
#!/usr/bin/env bash
set -e
echo -n "Publishing dummy messages: "
while true; do
echo -n "."
date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
message="{\"id\": \"$(uuidgen)\", \"created_at\": \"$date\", \"some_key\": \"some value\"}"
echo $message | kafkacat -P -b 0.0.0.0:9092 -t my_dummy_queue
sleep 0.8
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment