-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.sh
executable file
·29 lines (24 loc) · 1.34 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Read env parameters
. conf/env.conf
# Get Hostname and Port
HOSTNAME=$(avn --auth-token $TOKEN service get $SERVICE_NAME --project $PROJECT_NAME --json | jq -r '.components[] | select(.component=="kafka").host')
PORT=$(avn --auth-token $TOKEN service get $SERVICE_NAME --project $PROJECT_NAME --json | jq -r '.components[] | select(.component=="kafka").port')
echo $HOSTNAME $PORT
if [ $PRIVATELINK == "YES" ]; then
HOSTNAME=$(avn --auth-token $TOKEN service get $SERVICE_NAME --project $PROJECT_NAME --json | jq -r '.components[] | select(.route=="privatelink" and .component=="kafka").host')
PORT=$(avn --auth-token $TOKEN service get $SERVICE_NAME --project $PROJECT_NAME --json | jq -r '.components[] | select(.route=="privatelink" and .component=="kafka").port')
fi
# Get Certificates
rm -rf ./certs
avn --auth-token $TOKEN service user-creds-download $SERVICE_NAME --project $PROJECT_NAME --username avnadmin -d ./certs
# Create topic
avn --auth-token $TOKEN service topic-create $SERVICE_NAME $TOPIC --project $PROJECT_NAME --partitions $PARTITIONS --replication $REPLICATION
# Gererate Data
python python-fake-data-producer-for-apache-kafka/main.py --cert-folder ./certs/ \
--host $HOSTNAME \
--port $PORT \
--topic-name $TOPIC \
--nr-messages $NR_MESSAGES \
--max-waiting-time $MAX_TIME \
--subject $SUBJECT \
--security-protocol $SECURITY