-
Notifications
You must be signed in to change notification settings - Fork 0
/
kafka_producer.sh
17 lines (15 loc) · 1018 Bytes
/
kafka_producer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
iterations=100
for ((i = 1; i <= iterations; i++)); do
current_time=$(date +"%Y-%m-%d %H:%M:%S")
kafkacat -P -b kafka:9092 -t stock << EOF
{"Symbol":"APPL","date":"$current_time","open":142.5000,"high":142.5000,"low":141.7800,"close":141.7800,"volume":3}
{"Symbol":"APPL","date":"$current_time","open":142.5000,"high":142.5000,"low":141.7800,"close":141.7800,"volume":3}
{"Symbol":"APPL","date":"$current_time","open":142.5000,"high":142.5000,"low":141.7800,"close":141.7800,"volume":2}
{"Symbol":"APPL","date":"$current_time","open":148.5000,"high":148.5000,"low":148.0000,"close":148.0000,"volume":899}
{"Symbol":"XOM","date":"$current_time","open":559.5000,"high":559.5000,"low":559.0000,"close":559.0000,"volume":9789}
{"Symbol":"APPL","date":"$current_time","open":142.5000,"high":142.5000,"low":141.7800,"close":141.7800,"volume":99}
{"Symbol":"XOM","date":"$current_time","open":558.5000,"high":558.5000,"low":558.3500,"close":558.5000,"volume":1}
EOF
sleep 100
done