StackExchange.Redis Subscribe?

600 views
Skip to first unread message

Kevin Burton

unread,
Feb 13, 2015, 5:31:58 PM2/13/15
to redi...@googlegroups.com
Does anyone see a problem with this code usage using the StackExchange.Redis client library:

            var sub = Conn.GetSubscriber();
            sub.Subscribe("+odown", (channel, payload) => Console.WriteLine("Channel: {0} Message: {1}", channel, payload));

            Server.SentinelFailover("master");

            Thread.Sleep(40000);

For what ever reason I don't see the console message like I would expect after failing the master.

Ideas?


Kevin Burton

unread,
Feb 16, 2015, 10:06:35 AM2/16/15
to redi...@googlegroups.com
Thank you. I think I found my problem. I guess SentinelFailover just simulates a failover but the channel "+odown" is not published to.

Kevin Burton

unread,
Feb 16, 2015, 4:42:29 PM2/16/15
to redi...@googlegroups.com
I changed the code a little:

            var sub = Conn.GetSubscriber();
            sub.Subscribe("+odown", (channel, payload) => Console.WriteLine("Channel: {0} Message: {1}", channel, payload));
            sub.Subscribe("+failover-detected", (channel, payload) => Console.WriteLine("Channel: {0} Message: {1}", channel, payload));
            sub.Subscribe("switch-master", (channel, payload) => Console.WriteLine("Channel: {0} Message: {1}", channel, payload));
            sub.Subscribe("failover-end", (channel, payload) => Console.WriteLine("Channel: {0} Message: {1}", channel, payload));
            sub.Subscribe("selected-slave", (channel, payload) => Console.WriteLine("Channel: {0} Message: {1}", channel, payload));
            //Server.SentinelFailover(ServiceName);
            Thread.Sleep(60000);

Now I only see the "+odown" message. The other messages are ignored. Is there something in the StackExchange library that limits how many channels a subscriber can subscribe to?

On Friday, February 13, 2015 at 4:31:58 PM UTC-6, Kevin Burton wrote:

Josiah Carlson

unread,
Feb 17, 2015, 12:38:56 AM2/17/15
to redi...@googlegroups.com
I would help, but I don't use .Net so I have no idea. That said, though Marc (the author of the library) does sometimes reply to questions here, he also says "If you have a question, feel free to contact me." [1] You can find his email address at [2].


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages