Skip to content

Commit c1d0590

Browse files
committed
feat: Add Redis queue support for S3 event notifications
- Add Redis client dependency to Cargo.toml - Extend Amazon S3 source to support Redis pub/sub for event notifications - Add redis_url and redis_channel configuration options - Implement RedisContext with async pub/sub support - Update change_stream to prefer Redis over SQS when both are configured - Add comprehensive documentation for MinIO Redis setup - Update Python spec to include Redis configuration fields This enables MinIO users to receive S3-compatible event notifications without requiring AWS SQS, addressing issue #599.
1 parent 0dc1a48 commit c1d0590

File tree

5 files changed

+256
-19
lines changed

5 files changed

+256
-19
lines changed

Cargo.lock

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,4 @@ azure_storage_blobs = { version = "0.21.0", default-features = false, features =
146146
"hmac_rust",
147147
] }
148148
serde_path_to_error = "0.1.17"
149+
redis = { version = "0.31.0", features = ["tokio-comp", "connection-manager"] }

docs/docs/ops/sources.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,33 @@ This is how to setup:
117117

118118
AWS's [Guide of Configuring a Bucket for Notifications](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ways-to-add-notification-config-to-bucket.html#step1-create-sqs-queue-for-notification) provides more details.
119119

120+
#### (Alternative) Setup Redis for event notifications (MinIO)
121+
122+
For MinIO setups that don't use AWS SQS, you can configure MinIO to publish event notifications to Redis:
123+
124+
* Configure MinIO to publish events to Redis by setting environment variables:
125+
```bash
126+
export MINIO_NOTIFY_REDIS_ENABLE="on"
127+
export MINIO_NOTIFY_REDIS_ADDRESS="redis-endpoint.example.net:6379"
128+
export MINIO_NOTIFY_REDIS_KEY="bucketevents"
129+
export MINIO_NOTIFY_REDIS_FORMAT="namespace"
130+
```
131+
Replace the values with your Redis server details.
132+
133+
* Alternatively, use the `mc` command-line tool:
134+
```bash
135+
mc alias set myminio http://minio.example.com:9000 ACCESSKEY SECRETKEY
136+
mc admin config set myminio/ notify_redis \
137+
address="redis-endpoint.example.net:6379" \
138+
key="bucketevents" \
139+
format="namespace"
140+
mc admin service restart myminio
141+
```
142+
143+
* Ensure your Redis server is accessible and configured to accept connections from MinIO.
144+
145+
MinIO's [Redis Notification Settings](https://min.io/docs/minio/linux/reference/minio-server/settings/notifications/redis.html) documentation provides more details on configuration options.
146+
120147
### Spec
121148

122149
The spec takes the following fields:
@@ -144,6 +171,17 @@ The spec takes the following fields:
144171

145172
:::
146173

174+
* `redis_url` (`str`, optional): if provided, the source will receive change event notifications via Redis pub/sub. This is particularly useful for MinIO setups that publish events to Redis instead of SQS.
175+
176+
* `redis_channel` (`str`, optional): the Redis channel to subscribe to for event notifications. Required when `redis_url` is provided.
177+
178+
:::info
179+
180+
Redis pub/sub is preferred over SQS when both are configured. This allows MinIO users to receive S3-compatible event notifications without requiring AWS SQS.
181+
The Redis implementation expects S3 event notifications in the same JSON format as SQS messages.
182+
183+
:::
184+
147185
### Schema
148186

149187
The output is a [*KTable*](/docs/core/data_types#ktable) with the following sub fields:

python/cocoindex/sources/_engine_builtin_specs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class AmazonS3(op.SourceSpec):
4646
included_patterns: list[str] | None = None
4747
excluded_patterns: list[str] | None = None
4848
sqs_queue_url: str | None = None
49+
redis_url: str | None = None
50+
redis_channel: str | None = None
4951

5052

5153
class AzureBlob(op.SourceSpec):

0 commit comments

Comments
 (0)