ansur
2013-03-13 14:51:20 UTC
ansur [https://community.jboss.org/people/ansur] created the discussion
"Reprocess DLQ"
To view the discussion, visit: https://community.jboss.org/message/802383#802383
--------------------------------------------------------------
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
[https://community.jboss.org/message/802383#802383]
Start a new discussion in JBoss Messaging at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042]
"Reprocess DLQ"
To view the discussion, visit: https://community.jboss.org/message/802383#802383
--------------------------------------------------------------
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
[https://community.jboss.org/message/802383#802383]
Start a new discussion in JBoss Messaging at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042]