forked from vdesabou/kafka-docker-playground
-
Notifications
You must be signed in to change notification settings - Fork 1
/
oracle11.sh
executable file
·40 lines (34 loc) · 1.58 KB
/
oracle11.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
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source ${DIR}/../../scripts/utils.sh
if [ ! -f ${DIR}/ojdbc6.jar ]
then
logerror "ERROR: ${DIR}/ojdbc6.jar is missing. It must be downloaded manually in order to acknowledge user agreement"
exit 1
fi
${DIR}/../../environment/plaintext/start.sh "${PWD}/docker-compose.plaintext.yml"
log "Creating Oracle source connector"
curl -X PUT \
-H "Content-Type: application/json" \
--data '{
"connector.class":"io.confluent.connect.jdbc.JdbcSourceConnector",
"tasks.max":"1",
"connection.user": "myuser",
"connection.password": "mypassword",
"connection.url": "jdbc:oracle:thin:@oracle:1521/XE",
"numeric.mapping":"best_fit",
"mode":"timestamp",
"poll.interval.ms":"1000",
"validate.non.null":"false",
"table.whitelist":"MYTABLE",
"timestamp.column.name":"UPDATE_TS",
"topic.prefix":"oracle-",
"schema.pattern":"MYUSER",
"errors.log.enable": "true",
"errors.log.include.messages": "true"
}' \
http://localhost:8083/connectors/oracle-source/config | jq .
sleep 5
log "Verifying topic oracle-MYTABLE"
timeout 60 docker exec connect kafka-avro-console-consumer -bootstrap-server broker:9092 --property schema.registry.url=http://schema-registry:8081 --topic oracle-MYTABLE --from-beginning --max-messages 1