Why does the JMS QueueBrowse returns duplicate messages in infinite loop

Solution Unverified - Updated -

Issue

  • While using the browse method from JMS QueueBrowser, the method hasMoreElements from object ActiveMQQueueBrowser return 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.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.