1 Reply Latest reply on May 8, 2007 2:47 PM by freak hagga

    Rerun DLQ messages?

    freak hagga Newbie

      Any way to rerun the DLQ messages?

      I don't want to implement a DLQ MDB b/c that would require constantly processing DLQs ...

      If a service is down then messages will bubble back into the DLQ, and its a natural temp place to store those messages.

      Having a DLQ MDB is problematic as that would simply retry the message that is going to fail ... which is why we need a manual way to rerun messages in the DLQ, like a JMX call.

      Is there a way via jmx to lookup the DLQ and rerun messages?

        • 1. Re: Rerun DLQ messages?
          freak hagga Newbie

          So here is how to rerun expected messages from the DLQ. The close() calls are not perfect ...

          And I coded up a JMX call to do this:

          try
           {
           InitialContext ctx = new InitialContext();
           QueueConnection qc = TxsQueue.newConnection(ctx);
           Queue queue = TxsQueue.newQueue( ctx, "queue/DLQ" );
           QueueSession session = qc.createQueueSession(true, javax.jms.Session.AUTO_ACKNOWLEDGE);
           QueueReceiver qr = session.createReceiver(queue);
           qc.start();
          
           for( Message m = qr.receiveNoWait(); m != null; )
           {
           if( m instanceof ObjectMessage )
           {
           ObjectMessage om = (ObjectMessage) m;
           Object obj = om.getObject();
          
           if(obj instanceof BaseTaskMessage)
           {
           TxsQueue.send(Constants.MDB_TASKS, om.getObject());
           }
           else if( obj instanceof BaseEmailMessage )
           {
           TxsQueue.send(Constants.MDB_EMAIL, om.getObject());
           }
           }
          
           m = qr.receiveNoWait();
           }
          
           qr.close();
           session.close();
           qc.close();
           }
           catch(Exception e)
           {
           e.printStackTrace();
           }