@@ -113,23 +113,37 @@ curl -X POST -H "Content-Type: application/json" --data '
113
113
{"name": "redis-source",
114
114
"config": {
115
115
"tasks.max":"1",
116
- "connector.class":"com.redis.kafka.connect.RedisSourceConnector ",
116
+ "connector.class":"com.redis.kafka.connect.RedisStreamSourceConnector ",
117
117
"redis.uri":"redis://redis:6379",
118
118
"redis.stream.name":"mystream",
119
119
"topic": "mystream"
120
120
}}' http://localhost:8083/connectors -w " \n"
121
121
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
+
122
134
sleep 2
123
135
echo -e " \nKafka Connectors: \n"
124
136
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
125
139
126
140
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
128
142
129
143
sleep 2
130
144
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"
133
147
134
148
echo -e ' ' '
135
149
@@ -141,7 +155,7 @@ Examine the topics in the Kafka UI: http://localhost:9021 or http://localhost:80
141
155
The `pageviews` stream in Redis should contain the sunk page views: redis-cli xlen pageviews
142
156
143
157
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
145
159
- List some RedisJSON keys: SCAN 0 TYPE ReJSON-RL
146
160
- Show the JSON value of a given key: JSON.GET pageviews:971
147
161
==============================================================================================================
0 commit comments