Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Consuming messages from a Hazelcast Queue only once in a distributed environment

Vishal Cfdsingh
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing a problem with consuming messages in a distributed environment using hazelcast queue item listeners. The messages are consumed by all nodes/jvms which has subscribed for itemAdded event. I want to receive the itemAdded event only once in one of the nodes, similar to a JMS queue.

When I tried using a queue to publish messages and added an item listener in two different JVMs, I am receiving the messages twice in both of them. I want to receive the message only once in a clustered/distributed environments.

Here's my code snippet:

Publishing of the message:

I have the same listener configured in two different JVMs which goes like this:

Has anyone faced this kind of issue and can help?

Thanks in advance
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic