Closed SS-TruMinds closed 1 year ago
Hi, there is currently no example of this in the repo, but it would be welcomed.
Due to the description in the "Events in a cluster" section (at the end of the page) I would guess the redisClusterAsyncCommandToNode()
API should be used to subscribe to each nodes events.
The given callback-function should then get the subscribe response, the pushed messages and the unsubscribe response (if triggered).
One caveat that I know of is that hiredis
1.1.0 should be used since 1.0.x had a bunch of issues regarding pubsub when using the async API.
Hello,
Thank you for the response. We will try this out & try to provide an example.
I understand pub/sub would have to be on a separate async context, as this context cannot be used for other commands. I also understand that the same context can be used to subscribe to all the nodes of the cluster. Please could you confirm?
Thank you.
Yes, I think you are right. If you are using RESP2 (the redis default) you would need a separate async context, and the same hiredis-cluster context can be used when subscribing to all nodes individually.
Hello, do you have any examples of pub/sub for keyspace notifications with async contexts? Has this been tried before? Do you have any observations to share?
Thank you.