-
Notifications
You must be signed in to change notification settings - Fork 138
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
Redis PubSub #226
Comments
It could be possible to provide this feature by implementing some clever wrapping utilizing the In the mean time the easiest way to get a let obj = deadpool_redis::Connection::take(pool.get().await?);
let pubsub = obj.into_pubsub(); Due to the |
I'm closing this as I don't think it's very practical to use a pool for listening for messages. I might be totally wrong so please feel free to comment here and/or open a new issue describing a use case where this is needed. |
Yep your right, this ended up being an issue with the redis pubsub implementation itself. I think it was a third party library which was merged into it? |
Would keyspace notifications be a use case? I need to know about changes to a particular key, but once they've happened, I'm done with it. |
I'm also interested in a pooled pubsub usecase. We're using an adhoc pubsub channel to add some request/response type semantic; a stream for the return channel means that the data would be persisted, and we want something more ephemeral so we don't have to worry about cleanup, so looking at using pubsub. Pubsub works well, but creating a new connection every time isn't very efficient. |
This comment was marked as outdated.
This comment was marked as outdated.
I once again fell into the trap of confusing #226 (comment) is still correct about the way it needs to be implemented. The connection wrapper needs to provide a |
Would that solution be a workaround because of the current limitations in My eventual solution was to write a custom PubSub implementation for my specific usecase and use deadpool for the plain TCP connections, but obviously that was a heavy-handed approach 🙂 |
Any update 😢 |
|
updated. |
Are there any updates here? What's currently the idiomatic way to subscribe to a stream of messages with redis::Client::open("redis://127.0.0.1"); |
I just checked the documentation and example code from the current After a bit more digging it is possible to convert a I currently see only one way for this to work:
It really is a bummer that the It's weird as the |
Yeah, the way the connection is designed feels very awkward. Even stranger is that Would a change in |
Now that I understand the difference between A better approach would be a stream like API that only starts buffering messages as long as there is a consumer waiting for messages. I can work around this in Maybe there is a chance to change this to a |
Redis 0.27.6 just got released and after checking the current
|
There's a
.publish()
method in deadpool redis but I can't find any way to subscribe to channels for pubsub usage in redis. How should I go about this, and are there any async alternatives if deadpool doesn't support it?The text was updated successfully, but these errors were encountered: