Repository navigation
Add Redis Cluster broker support - #2854
Merged
Merged
Conversation
powersemmi
force-pushed
the
feature/redis-cluster-broker
branch
2 times, most recently
from
May 4, 2026 16:36
3528945 to
fc42629
Compare
powersemmi
force-pushed
the
feature/redis-cluster-broker
branch
2 times, most recently
from
May 4, 2026 16:44
1b035b0 to
2a2b32a
Compare
powersemmi
force-pushed
the
feature/redis-cluster-broker
branch
13 times, most recently
from
May 11, 2026 09:51
298004c to
cf6ae92
Compare
powersemmi
force-pushed
the
feature/redis-cluster-broker
branch
4 times, most recently
from
May 14, 2026 13:17
ef6f1ca to
22fdfcc
Compare
|
I had an agent attempt this in this PR but I am told by @Lancetnik that this PR should be getting merged soon Linking the code in case it is useful, and looking forward to seeing this merged 🙌 |
powersemmi
force-pushed
the
feature/redis-cluster-broker
branch
from
May 24, 2026 04:24
22fdfcc to
77abc58
Compare
Extract `ClusterConnectionState` logic into the base `ConnectionState` class as a generic, and move shared broker type annotations into a new `faststream/redis/schemas/types.py` module to reduce import clutter and duplication.
- Unify TestRedisBroker and TestRedisClusterBroker: cluster bootstrap logic moved into TestRedisBroker._create_ctx, gated by an isinstance check on RedisClusterConnectionState. - Use Sequence instead of list for RedisClusterParams.startup_nodes and the matching _resolve_url_options signature; mark RedisClusterParams total=False so the field stays optional. - Mark cluster tests slower than 1s with @pytest.mark.slow (xautoclaim circular scanning, pubsub_more module, middleware classes, and the publish tests that wait on events).
powersemmi
force-pushed
the
feature/redis-cluster-broker
branch
from
May 24, 2026 04:25
77abc58 to
3a7778b
Compare
powersemmi
enabled auto-merge
May 24, 2026 06:22
Lancetnik
approved these changes
May 25, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
May 25, 2026
|
@Lancetnik Great to see this merged. Will you be tagging a release that includes this change? |
PAzter1101
added a commit
to PAzter1101/faststream
that referenced
this pull request
Jun 3, 2026
…Broker Per review feedback on ag2ai#2895, Sentinel support now lives in its own RedisSentinelBroker / RedisSentinelRouter instead of extra parameters on the generic RedisBroker — mirroring RedisClusterBroker (ag2ai#2854), so each topology is a distinct broker class and Sentinel params no longer leak into RedisBroker / RedisClusterBroker. - RedisSentinelConnectionState builds the client via Sentinel.master_for(); the generic RedisBroker / RedisRouter keep their original API. - RedisSentinelParams holds sentinels / sentinel_master_name / sentinel_kwargs. - RedisSentinelRouter adds FastAPI Sentinel support (which RedisClusterBroker does not provide). - Docs: docs/en/redis/sentinel.md + navigation entry. Refs ag2ai#1812
7 of 9 tasks
Lancetnik
added a commit
that referenced
this pull request
Sep 23, 2026
redis-py 8.0.0 gave the async `RedisCluster` `publish` and `pubsub`, so the synchronous workaround from #2854 can go: no second Redis client, no `ThreadPoolExecutor` in an otherwise async path, and no cluster-only code branch wherever Pub/Sub is involved. `RedisClusterFastProducer`, `_SyncPubSubProxy`, `sync_publish()`, `_get_sync_cluster()` and the `_sync_cluster` / `_thread_pool` fields on the base `ConnectionState` are gone. Cluster now uses the same `RedisFastProducer` and the stock `ChannelSubscriber.start()` as standalone, which also means every connection option — `credential_provider` for IAM / token auth included — reaches Channels, Lists and Streams through one client. BREAKING CHANGE: `faststream[redis]` now requires `redis>=8.0.0`. Closes #3009 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Lancetnik
added a commit
that referenced
this pull request
Sep 23, 2026
redis-py 8.0.0 gave the async `RedisCluster` `publish` and `pubsub`, so the synchronous workaround from #2854 can go: no second Redis client, no `ThreadPoolExecutor` in an otherwise async path, and no cluster-only code branch wherever Pub/Sub is involved. `RedisClusterFastProducer`, `_SyncPubSubProxy`, `sync_publish()`, `_get_sync_cluster()` and the `_sync_cluster` / `_thread_pool` fields on the base `ConnectionState` are gone. Cluster now uses the same `RedisFastProducer` and the stock `ChannelSubscriber.start()` as standalone, which also means every connection option — `credential_provider` for IAM / token auth included — reaches Channels, Lists and Streams through one client. BREAKING CHANGE: `faststream[redis]` now requires `redis>=8.0.0`. Closes #3009 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces
RedisClusterBroker— a new broker for Redis Cluster, inheriting fromRedisBrokerwith the same constructor API for drop-in compatibility.Key features:
startup_nodeswith auto-discoveryPUBLISH/SUBSCRIBE,sharded=False) for single-node deliveryRedisClusterclientmin_idle_time)RedisBrokerAPI compatibility — migrate by changing the class nameRuntimeWarningifpipeline=is passed (not supported in cluster)Documentation:
docs/docs/en/redis/cluster.md— feature comparison, migration guide, limitationsFixes #1170
Type of change
Checklist
just lintshows no errors)just test-coveragejust static-analysis