我正在尝试在处理消息后从IQueue中删除队列。但它没有从队列中删除。我已经调用了删除方法,如下所示,
class HazelcastSample implements ItemListener<testMessage>{
void replicateMessage(){
TestHazelcast.getInstance().getHazelcastInstance().getQueue("testQueue").put(testMessage);
}
public void itemAdded(ItemEvent<testMessage> event) {
testMessage sampleMessage = (testMessage) event.getItem();
IQueue<Object> sampleQueue= TestHazelcast.getInstance().getHazelcastInstance().getQueue("testQueue");
boolean removed = false;
removed = sampleQueue.remove(sampleMessage);
}
}
can you please help what is wrong? why remove method is not working?
Thank you,
chandra