Why does the JMS QueueBrowse returns duplicate messages in infinite loop
Issue
- While using the browse method from JMS
QueueBrowser, the methodhasMoreElementsfrom objectActiveMQQueueBrowserreturn duplicate message in a infinite loop.
Example:
QueueBrowser mc;
....
mc = s.createBrowser(queueSample);
Enumeration<TextMessage> e = mc.getEnumeration();
while (e.hasMoreElements()) {
TextMessage tm = e.nextElement();
String id = tm.getJMSMessageID();
if (ids.contains(id)) {
log.error(id + " ** duplicate" + "\n\n\n");
break;
}
ids.add(id);
log.info(count + " " + tm.getJMSMessageID());
count++;
}
Environment
- Red Hat JBoss A-MQ
- 6.0
- ActiveMQ
- 5.8
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
