forked from lamprosm/RADAR-Schemas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtopic_init.sh
executable file
·31 lines (23 loc) · 913 Bytes
/
topic_init.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
30
31
#!/bin/bash
NUM_TRIES=${TOPIC_INIT_TRIES:-20}
if [ -z NO_VALIDATE ]; then
radar-schemas-tools validate merged
fi
# Create topics
echo "Creating RADAR-base topics. Will try ${NUM_TRIES} times..."
if radar-schemas-tools create -c "${KAFKA_CONFIG_PATH}" -p $KAFKA_NUM_PARTITIONS -r $KAFKA_NUM_REPLICATION -b $KAFKA_NUM_BROKERS -s "${KAFKA_BOOTSTRAP_SERVERS}" -n ${NUM_TRIES} merged; then
echo "Created topics"
else
echo "FAILED TO CREATE TOPICS"
exit 1
fi
echo "Topics created."
echo "Registering RADAR-base schemas..."
if ! radar-schemas-tools register --force -u "$SCHEMA_REGISTRY_API_KEY" -p "$SCHEMA_REGISTRY_API_SECRET" "${KAFKA_SCHEMA_REGISTRY}" merged; then
echo "FAILED TO REGISTER SCHEMAS"
exit 1
fi
echo "Schemas registered."
echo "*******************************************"
echo "** RADAR-base topics and schemas ready **"
echo "*******************************************"