Created
August 8, 2023 07:58
-
-
Save un4ckn0wl3z/623eaf71c69cda39c48a7d7ec0870308 to your computer and use it in GitHub Desktop.
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 | |
# Define the Kafka broker and topic | |
BROKER_LIST="localhost:9092" | |
TOPIC="mfaf.exampleTopic" | |
# Loop to simulate load test | |
while true; do | |
# Generate some random JSON data and save it to a file | |
# echo "{\"key\": \"value\"}" > m.json | |
# Use kafka-console-producer to send the JSON data to the Kafka topic | |
kafka-console-producer --broker-list $BROKER_LIST --topic $TOPIC < m.json | |
# Optional: You can add a delay between sending messages to control the load rate | |
# sleep 1 # Add a 1-second delay | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment