0

I have 2 nodes that use Hazelcast.

Node A is a Producer, it puts items into a Queue

Node B is a Consumer, it consume or pool items from the Queue. I add ItemListener into Node B so when an item added to the queue, the consumer will notice and start to consume.

There's nothing wrong if everything work fine, but.. Sometimes the consumer is shutdown, and the producer still working and put item to the queue. When I start the consumer again, it just consume when the producer add an item. So.. how about the pending item.

I'm using Hazelcast 3.3.

Is there any solution for this problem..?

Thanks.

  • Which Hazelcast version are you using? It sounds like a bug to me; could you create a unit test that verifies that the behavior is broken and create a bug in github? https://github.com/hazelcast/hazelcast/issues – pveentjer Dec 01 '14 at 04:43
  • I'm not sure this sounds like a bug. As far as I understood node B is shutdown at some point and listeners are fire and forget, so if the node is not available you don't get the result redelivered. After restart of node B you have to consume the items in the queue using poll and take until the queue is empty, new items can then be listened. – noctarius Dec 01 '14 at 05:24

1 Answers1

0

It not a bug, the ItemListener is a listener so it is fired when add/remove items so you have to add a new functionality when your consumer starts to check if there are any pending element in the queue.

In my case I just create a heartbeat to ask the queue if there are any element, in that case the consumer method is executed.