7 Replies Latest reply on Aug 25, 2011 7:29 AM by alansmanne

    How to browse the DLQ?




      I've been trying to read the messages from the Jboss DLQ for some times... but without success.


      First, i've tried to use a QueueBrowser. I thought it could display the messages in the DLQ as they are stuck there and never received by any client.


      Queue DLQueue = ServiceLocator.getInstance().getQueue("queue/DLQ"); QueueConnectionFactory queueConnectionFactory = ServiceLocator.getInstance().getQueueConnectionFactory("ConnectionFactory"); //Service locator is a wrapper that does (QueueConnectionFactory) context.lookup("qConnFactoryName") QueueConnection queueConnection = queueConnectionFactory.createQueueConnection(); QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); QueueBrowser DLQBrowser = queueSession.createBrowser(DLQueue); Enumeration dlqEnum = DLQBrowser.getEnumeration(); while (dlqEnum.hasMoreElements()) {        Object object = dlqEnum.nextElement();        // Do something with object } queueConnection.close();


      But the enumeration is empty...


      I've also tried to use the JMX-console. When I click on name=DLQ,service=Queue, then listMessageCounter(), i can see that there are indeed 100 messages in the DLQ. But when I try to browse them :


      • listScheduledMessages() : empty ...
      • listMessages() : empty...
      • listInProcessMessages() : empty...


      Then, I tried to open the HSQL database myself with DBVisualizer to browse the JMS_MESSAGES table. But I was only able to see some messages IDS, but not the message itself.


      My last option is to use a Message Listener on the DLQ and do all the business to store them somewhere I can easily access... if I can't use any of the previous options.


      Any help is appreciated.


      Aurélien Lansmanne.

        • 1. How to browse the DLQ?

          I could guess the problem could be in the transaction.


          Some visual tools can show the uncommitted messages in UOW too.


          Classical JMS code will not show you the uncommitted messages.


          Check the configuration of your JBoss regarding XA, or transaction model.

          • 2. Re: How to browse the DLQ?

            I would like to know whether the ServiceLocator used in the program is a API class or a user defined class?

            • 3. Re: How to browse the DLQ?

              It's a custom class. Basically, it's just a wrapper around the InitialContext, with some cache to avoid useless requests.


              We never solved this problem, but we managed to track all errors and use a custom logging system to trace every message sent and read from/to the Queue

              • 4. Re: How to browse the DLQ?

                Thanks Aurelien for your quick reply.

                Could you please share that code. Actually we are using seam to instantiate queue sender to send messages to the queue or is there any other way to instantiate the queue?


                Basically my requirement is to delete the messages from the DLQ.We are using default DLQ to handle the failure messages.Once the message reaches DLQ, it will be persistented in the DB. we are using Oracle for persistence. I am able to see the Jboss tables and the messages in our oracle DB .

                Now i can do two actions.

                1) Browse all the messages

                2) Delete the message from DLQ, which should eventually delete the from DB as well.


                How can i achieve this tasks? Please let me know if you need any clarifications!

                • 5. Re: How to browse the DLQ?

                  I'm sorry but I can't share all my code.

                  Queue queue = ServiceLocator.getInstance().getQueue("queue/myQueue");

                  is the same as


                  Where "queue/remoteNotifQueue" is defined in jbossmq-destinations-service.xml

                  <mbean code="org.jboss.mq.server.jmx.Queue"


                      <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>

                      <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>

                      <attribute name="MessageCounterHistoryDayLimit">-1</attribute>

                      <attribute name="SecurityConf">


                          <role name="guest" read="true" write="true" create="true"/>






                  The DLQ is stored using an hsql local database. If you can connect to this local database, you should be able to browse the DLQ with a simple query :

                  SELECT messageid FROM jms_messages WHERE destination = 'QUEUE.DLQ'


                  The configuration file is hsqldb-ds.xml in jbossdir/server/xxxx/deploy/

                  The default datasource name is <jndi-name>DefaultDS</jndi-name>

                  So you should be able to connected using something like

                  dataSource = (DataSource) context.lookup("java:/DefaultDS");


                  • 6. Re: How to browse the DLQ?

                    Hi Aurelien,

                    Thats fine.


                    If i want to delete the messages from the DLQ, is there any API do that, or i need to delete the messages manually(creating a db connection and using prepared statements) from the DB?

                    • 7. Re: How to browse the DLQ?

                      The manual database deletion was the only solution that worked for us. Maybe there are alternatives on Jboss versions > 4.2.2.