3 if [[ -n "$MM_AGENT_WAIT_TIME" ]]; then
4 ORD=$(eval $BROKER_ID_COMMAND)
5 if [ "$ORD" = "0" ]; then
6 echo "wait for $MM_AGENT_WAIT_TIME before start of the mirror maker agent"
7 sleep $MM_AGENT_WAIT_TIME
8 java -jar /tmp/dmaapMMAgent.jar
13 if [[ -z "$START_TIMEOUT" ]]; then
17 start_timeout_exceeded=false
20 while netstat -lnt | awk '$4 ~ /:'$KAFKA_PORT'$/ {exit 1}'; do
21 echo "waiting for kafka to be ready"
23 count=$(expr $count + $step)
24 if [ $count -gt $START_TIMEOUT ]; then
25 start_timeout_exceeded=true
30 if $start_timeout_exceeded; then
31 echo "Not able to auto-create topic (waited for $START_TIMEOUT sec)"
35 if [[ -n $KAFKA_CREATE_TOPICS ]]; then
36 IFS=','; for topicToCreate in $KAFKA_CREATE_TOPICS; do
37 echo "creating topics: $topicToCreate"
38 IFS=':' read -a topicConfig <<< "$topicToCreate"
39 if [ ${topicConfig[3]} ]; then
40 JMX_PORT='' $KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper $KAFKA_ZOOKEEPER_CONNECT --replication-factor ${topicConfig[2]} --partitions ${topicConfig[1]} --topic "${topicConfig[0]}" --config cleanup.policy="${topicConfig[3]}" --if-not-exists
42 JMX_PORT='' $KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper $KAFKA_ZOOKEEPER_CONNECT --replication-factor ${topicConfig[2]} --partitions ${topicConfig[1]} --topic "${topicConfig[0]}" --if-not-exists