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

Subscription dies on server reset with no reconnect or indication of failure #32

Open
jencompgeek opened this issue Aug 14, 2013 · 0 comments

Comments

@jencompgeek
Copy link

If a client is subscribed and the server is bounced, no attempt is made to resubscribe the client (and of course no Exception is thrown since the thread does not block on the subscribe call).

This can be reproduced by running the following test, putting a breakpoint on creation of client3 and bouncing the Redis server before continuing. "World" is not printed out.

    @Test
    public void testSubscribe() throws IOException {
        RedisClient client = new RedisClient("localhost", 6379);
        client.addListener(new SrpListener());
        client.subscribe("channel1".getBytes());
        RedisClient client2 = new RedisClient("localhost", 6379);
        client2.publish("channel1".getBytes(), "Hello".getBytes());
        RedisClient client3 = new RedisClient("localhost", 6379);
        client3.publish("channel1".getBytes(), "World".getBytes());
    }

    private class SrpListener implements ReplyListener {
        public void subscribed(byte[] name, int channels) {
        }

        public void psubscribed(byte[] name, int channels) {
        }

        public void unsubscribed(byte[] name, int channels) {
        }

        public void punsubscribed(byte[] name, int channels) {
        }

        public void message(byte[] channel, byte[] message) {
            System.out.println(new String(message));    
        }

        public void pmessage(byte[] pattern, byte[] channel, byte[] message) {
        }
    }
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