1

since I couldn't find anything explicitly explaining how to use an RQueue in an actual distributed setup that differs from the default single instance examples, I hope someone here can explain my mistake.

I have a multiple microservices instances that all utilize Redisson with the same Redis connection in order to retrieve elements from an RQueue. It's a single connection via port-forwarding to a Kubernetes service backed by a 3-node Redis Sentinel Cluster (Redis 6.0.9 deployed via Helm chart). If each service executes a single poll() on the RQueue and they all receive the same object.

redissonClient.<Job>getQueue(queueKey).poll();

In my understanding this should not happen and another service instance should never be able to poll a previously polled element, too.

The queue only works as expected when I execute polls from the same service instance. Is this maybe just a configuration issue I'm not aware of?

If this question does not provide enough information or context, I will gladly enhance it accordingly!

And thanks in advance for any help!

godsim
  • 181
  • 1
  • 9
  • Make sure you don't store same object multiple times in queue. – Nikita Koksharov Jan 03 '21 at 16:10
  • There are definitely only unique items. As described, if the queue is polled from the same service instance, it returns objects as expected. – godsim Jan 04 '21 at 17:26
  • that's impossible to get duplications if objects are really unique. Please check your code – Nikita Koksharov Jan 05 '21 at 07:27
  • it is absolutely possible, re-read what I wrote. It's not about duplicates per se, but about "poll" not removing them from the Redis queue correctly, since elements remain for other service instance pollable, too. – godsim Jan 06 '21 at 18:06
  • 1
    poll method uses https://redis.io/commands/lpop. Which is *removes* and returns the first elements – Nikita Koksharov Jan 07 '21 at 06:45
  • ok cool, and what is your point exactly? I'm not using Redis console commands but the Java Redisson client. A "poll" should do exactly the same as per definition. – godsim Jan 08 '21 at 09:28
  • And it does. I'm unable to reproduce the issue you describe. Can you provide some test code? – Nikita Koksharov Jan 08 '21 at 09:45
  • I will try to provide some snippets until end of the week, but it's basically just the provided line in the question, wrapped by some spring boot boilerplate code. And you tested this with multiple (!) concurrently running service instances connectiong to a 3-node Redis Sentinel Cluster? – godsim Jan 11 '21 at 10:13

0 Answers0