JBoss Community

Reprocess DLQ

created by ansur in JBoss Messaging - View the full discussion

There have been some topics on removing messages from DLQ - which doesn't seem like something easy to accomplish with JMS.

 

The requirement that I have is that we need to enable users to reprocess a DLQ.

My current implementation boils down to the following snippet:

 

                final QueueBrowser browser = session.createBrowser(queue);
                final Enumeration<Message> jmsMessages = browser.getEnumeration();
                
                while(jmsMessages.hasMoreElements()) {
                    final Message jmsMessage = jmsMessages.nextElement();
                    final Destination destination = jmsMessage.getJMSDestination();
                    
                    sendMessage(jmsMessage, destination, session);
                }

 

I.e. create a browser, and for each message, get the destination and send it there. the sendMessage() method creates a MessageProducer and calls the send() method.

 

This is working fine, but the message isn't actually removed from the DLQ.

What behaviour would I need in order to have it removed after processing?

 

After all, if the message fails to process again, it would just en dup in the DLQ again - which is OK.

 

Finally, the above is part of a manual action. So I can't just register an MDB on the DLQ - it needs to be a manual invocation.

Reply to this message by going to Community

Start a new discussion in JBoss Messaging at Community