Skip to content

Commit 7805618

Browse files
committed
feat(demo): Added keys source connector config
1 parent 1b2dd9d commit 7805618

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

run.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,23 +113,37 @@ curl -X POST -H "Content-Type: application/json" --data '
113113
{"name": "redis-source",
114114
"config": {
115115
"tasks.max":"1",
116-
"connector.class":"com.redis.kafka.connect.RedisSourceConnector",
116+
"connector.class":"com.redis.kafka.connect.RedisStreamSourceConnector",
117117
"redis.uri":"redis://redis:6379",
118118
"redis.stream.name":"mystream",
119119
"topic": "mystream"
120120
}}' http://localhost:8083/connectors -w "\n"
121121

122+
sleep 2
123+
echo -e "\nAdding Keys Source Connector for keys 'mykey:*':"
124+
curl -X POST -H "Content-Type: application/json" --data '
125+
{"name": "redis-keys-source",
126+
"config": {
127+
"tasks.max":"1",
128+
"connector.class":"com.redis.kafka.connect.RedisKeysSourceConnector",
129+
"redis.uri":"redis://redis:6379",
130+
"redis.keys.patterns":"mykey:*",
131+
"topic": "mykeys"
132+
}}' http://localhost:8083/connectors -w "\n"
133+
122134
sleep 2
123135
echo -e "\nKafka Connectors: \n"
124136
curl -X GET "http://localhost:8083/connectors/" -w "\n"
137+
echo "Enabling keyspace notifications on Redis database:"
138+
docker compose exec redis /opt/redis-stack/bin/redis-cli config set notify-keyspace-events KEA
125139

126140
echo "Number of messages in 'pageviews' stream:"
127-
docker compose exec redis /usr/local/bin/redis-cli xlen pageviews
141+
docker compose exec redis /opt/redis-stack/bin/redis-cli xlen pageviews
128142

129143
sleep 2
130144
echo -e "\nAdding messages to Redis stream 'mystream':"
131-
docker compose exec redis /usr/local/bin/redis-cli "xadd" "mystream" "*" "field1" "value11" "field2" "value21"
132-
docker compose exec redis /usr/local/bin/redis-cli "xadd" "mystream" "*" "field1" "value12" "field2" "value22"
145+
docker compose exec redis /opt/redis-stack/bin/redis-cli "xadd" "mystream" "*" "field1" "value11" "field2" "value21"
146+
docker compose exec redis /opt/redis-stack/bin/redis-cli "xadd" "mystream" "*" "field1" "value12" "field2" "value22"
133147

134148
echo -e '''
135149
@@ -141,7 +155,7 @@ Examine the topics in the Kafka UI: http://localhost:9021 or http://localhost:80
141155
The `pageviews` stream in Redis should contain the sunk page views: redis-cli xlen pageviews
142156
143157
Examine the Redis database:
144-
- In your shell run: docker compose exec redis /usr/local/bin/redis-cli
158+
- In your shell run: docker compose exec redis /opt/redis-stack/bin/redis-cli
145159
- List some RedisJSON keys: SCAN 0 TYPE ReJSON-RL
146160
- Show the JSON value of a given key: JSON.GET pageviews:971
147161
==============================================================================================================

0 commit comments

Comments
 (0)