How to send message from JBoss 4.2.2 message queue after retry expired

Is there a way to resubmit expired messages in the JBoss 4.2.2 message queue? The problem is that they have exceeded the number of retries, but now the problem is fixed, so is there a way to resend them?

In JBoss 3, they were just text files that you could move around. Now that it is stored in the database, how can you do this?

0


a source to share


3 answers


Here's what I did:



    Hashtable t = new Hashtable();
    t.put(Context.PROVIDER_URL, "localhost:1099");
    t.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    Context ctx = new InitialContext(t);
    Queue q = (Queue) ctx.lookup("/queue/DLQ");
    //----------------------------
    ConnectionFactory cf = (ConnectionFactory) ctx.lookup("/ConnectionFactory");
    Connection connection = cf.createConnection();
    Session session = connection.createSession(true, 0);
    //---------------------------------
    MessageConsumer consumer = session.createConsumer(q);
    connection.start();
    SpyObjectMessage m;

    Queue originialDestination = null;
//There can only be one in my case, but really you have to look it up every time.
    MessageProducer producer = null;
    while ((m = (SpyObjectMessage) consumer.receive(5000)) != null) {
        Object o = m.getObject();
        Date messageDate = new Date(m.getJMSTimestamp());
        String originalQueue = m.getStringProperty("JBOSS_ORIG_DESTINATION");
            if (originialDestination == null) {
                originialDestination = (Queue) ctx.lookup("/queue/" +
 originalQueue.substring(originalQueue.indexOf('.') + 1));
                producer = session.createProducer(originialDestination);
            }
            producer.send(session.createObjectMessage((Serializable) o));
      m.acknowledge();
    }
    //session.commit();    //Uncomment to make this real.
    connection.close();
    ctx.close();

      

0


a source


Have a look at Hermes JMS . It is an open source tool for viewing JMS queues and topics. It can play back messages that end up in the non-executing broker queue.



+1


a source


Note. I am working for CodeStreet

Our product "ReplayService for JMS" is built for exactly this use case: finding and retrieving previously published messages (n-times delivery) - JMS is really meant for one-time delivery.

With ReplayService for JMS, you must configure WebLogic recording to write all messages posted to your topic or queue. Through the web user interface, you can search for individual messages (by substring, XPath, or JMS Selector) and then replay them back to the original JMS destination.

See http://www.codestreet.com/marketdata/jms/jms_details.php for details .

0


a source







All Articles