Skip to content

Instantly share code, notes, and snippets.

@cjmatta
Last active July 28, 2017 16:39
Show Gist options
  • Save cjmatta/1fbe85a20b2811e2b0852ee2f7aebc2c to your computer and use it in GitHub Desktop.
Save cjmatta/1fbe85a20b2811e2b0852ee2f7aebc2c to your computer and use it in GitHub Desktop.
Script to submit JSON connector config
{
"name": "wikipedia-irc",
"config": {
"producer.interceptor.classes": "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor",
"connector.class": "org.cmatta.kafka.connect.irc.IrcSourceConnector",
"irc.server": "irc.wikimedia.org",
"kafka.topic": "wikipedia.raw",
"irc.channels": "#en.wikipedia,#en.wiktionary,#en.wikibooks,#en.wikinews,#es.wikipedia,#fr.wikipedia",
"tasks.max": "2"
}
}
#!/bin/bash
if [[ $2 ]];then
CONNECT_HOST=$1
INPUT_FILE=$2
else
CONNECT_HOST=localhost:8083
INPUT_FILE=$1
fi
if [[ ! -f $INPUT_FILE ]]; then
echo "ERROR: Input file ${INPUT_FILE} not found!";
fi
HEADER="Content-Type: application/json"
echo "curl -s -X POST -H \"${HEADER}\" --data @${INPUT_FILE} http://${CONNECT_HOST}/connectors"
curl -s -X POST -H "${HEADER}" --data @${INPUT_FILE} http://${CONNECT_HOST}/connectors
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment