github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/_utils/run_kafka_consumer (about) 1 #!/bin/bash 2 3 # parameter 1: work directory 4 # parameter 2: sink_uri 5 # parameter 3: consumer_replica_config 6 # parameter 4: log suffix 7 8 set -e 9 10 workdir=$1 11 sink_uri=$2 12 consumer_replica_config=$3 13 schema_registry_uri=$4 14 log_suffix=$5 15 pwd=$pwd 16 17 echo "[$(date)] <<<<<< START kafka consumer in $TEST_NAME case >>>>>>" 18 cd $workdir 19 20 # Because there is no transaction concept in Kafka, 21 # we need to set `batch-dml-enable` to false to avoid data inconsistency. 22 downstream_uri="mysql://root@127.0.0.1:3306/?safe-mode=true&batch-dml-enable=false" 23 24 # some consumer may require `consumer_replica_config`, set it separately 25 if [ "$consumer_replica_config" != "" ] && [ "$schema_registry_uri" != "" ]; then 26 echo "consumer replica config found: $consumer_replica_config" 27 echo "schema registry uri found: $schema_registry_uri" 28 cdc_kafka_consumer --log-file $workdir/cdc_kafka_consumer$log_suffix.log --log-level info --upstream-uri $sink_uri --downstream-uri ${downstream_uri} --config $consumer_replica_config --schema-registry-uri $schema_registry_uri >>$workdir/cdc_kafka_consumer_stdout$log_suffix.log 2>&1 & 29 elif [ "$schema_registry_uri" != "" ]; then 30 echo "schema registry uri found: $schema_registry_uri" 31 cdc_kafka_consumer --log-file $workdir/cdc_kafka_consumer$log_suffix.log --log-level info --upstream-uri $sink_uri --downstream-uri ${downstream_uri} --schema-registry-uri $schema_registry_uri >>$workdir/cdc_kafka_consumer_stdout$log_suffix.log 2>&1 & 32 elif [ "$consumer_replica_config" != "" ]; then 33 echo "consumer replica config found: $consumer_replica_config" 34 cdc_kafka_consumer --log-file $workdir/cdc_kafka_consumer$log_suffix.log --log-level info --upstream-uri $sink_uri --downstream-uri ${downstream_uri} --config $consumer_replica_config >>$workdir/cdc_kafka_consumer_stdout$log_suffix.log 2>&1 & 35 else 36 cdc_kafka_consumer --log-file $workdir/cdc_kafka_consumer$log_suffix.log --log-level info --upstream-uri $sink_uri --downstream-uri ${downstream_uri} >>$workdir/cdc_kafka_consumer_stdout$log_suffix.log 2>&1 & 37 fi 38 39 cd $pwd