Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PubSub support for multiple channels and context managers #23

Open
BenjaminYong opened this issue May 23, 2023 · 0 comments
Open

PubSub support for multiple channels and context managers #23

BenjaminYong opened this issue May 23, 2023 · 0 comments

Comments

@BenjaminYong
Copy link

Hi @DriverX , I was testing the sharded ssubscribe and subscribe function and noticed that PubSubs in your library are limited to a single channel, getting error:

  • ValueError: Only one channel supported in cluster mode.

Are there plans to support multiple channels? Clients should be able to subscribe to multiple channels so long as they belong to the same slot. https://redis.io/commands/ssubscribe/.

  • i.e.result = await redis_cluster.ssubscribe('{key}:123', '{key}:456'

Also, is it possible to open a Pub/Sub context manager to handle subscription messages?
In aioredis, this is possible like this example: https://aioredis.readthedocs.io/en/latest/examples/#pubsub.

i.e.

channels = ['{key}:123', '{key}:456']
async with self.redis_cluster.pubsub() as pubsub:
    await pubsub.ssubscribe(*channels)

    async for result in pubsub.listen():
        yield result

Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant