Git Product home page Git Product logo

Comments (9)

mrniko avatar mrniko commented on September 25, 2024

Unable to reproduce with the test below. What did I miss?

        int loops = 10;
        AtomicInteger counter = new AtomicInteger();
        for (int j = 0; j < loops; j++) {
            RTopic t = redisson.getTopic("PUBSUB_" + j);
            t.addListener(String.class, new MessageListener<String>() {
                @Override
                public void onMessage(CharSequence channel, String msg) {
                    System.out.println("channel " + channel + " " + msg);
                    counter.incrementAndGet();
                }
            });
        }

        for (int j = 0; j < loops; j++) {
            RTopic t = redisson.getTopic("PUBSUB_" + j);
            for (int i = 0; i < 10; i++) {
                t.publish("message " + j + "_" + i);
            }
        }

        Thread.sleep(1000);

        assertThat(counter.get()).isEqualTo(loops * 10);

from redisson.

tzfun avatar tzfun commented on September 25, 2024

It is not easy to reproduce in a short period of time. You need to continue publishing messages, and then after running for a period of time, you will find that several channels cannot be consumed.

Unable to reproduce with the test below. What did I miss?

from redisson.

tzfun avatar tzfun commented on September 25, 2024

I don't know the specific reason. In my scenario: the same redis, the same number of channels, the same publish, the same configuration, and different Redisson versions.

I once suspected that the redis buffer overflow caused the client connection to be disconnected. I used the client list command to check the buffer usage and found that the buffer was very sufficient, thus ruling out the possibility of the redis server actively disconnecting.

Then I tried to add the Status listener of the Topic, and found that when the count bit of the publish result was 0, the status listener did not trigger any unsubscribe event. I tried repeatedly by switching different Redisson versions, and found that only 3.25.1 had no problem, so I had to Roll back to previous version.

from redisson.

mrniko avatar mrniko commented on September 25, 2024

Can you try 3.26.0?

from redisson.

tzfun avatar tzfun commented on September 25, 2024

Can you try 3.26.0?

I can test it later when I have time, but I'm sorry not now.

from redisson.

mrniko avatar mrniko commented on September 25, 2024

do you invoke RTopic.addListener() only once per channel? Total 10 channels?

from redisson.

tzfun avatar tzfun commented on September 25, 2024

This is my code. Each channel only triggers this code once.

        RTopic rt = getTopic(topic);

        rt.addListener(new StatusListener() {
            @Override
            public void onSubscribe(String channel) {
                logger.debug("redis channel subscribed {}", channel);
            }

            @Override
            public void onUnsubscribe(String channel) {
                logger.info("redis channel unsubscribed {}", channel);
            }
        });

        rt.addListener(
                TransformMessage.class,
                (channel, msg) -> executor.execute(() -> consume(MQMessage.create(channel.toString(), msg), consumer))
        );

from redisson.

mrniko avatar mrniko commented on September 25, 2024

Do you use a single Redis server or cluster setup?

from redisson.

tzfun avatar tzfun commented on September 25, 2024

No, my production environment uses sentinel mode.

Do you use a single Redis server or cluster setup?

from redisson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.