1 Reply Latest reply on Apr 17, 2002 3:04 AM by Peter Antman

    Changing Message Properties

    Puneet Narang Newbie

      Is it possible to change the properties of a message in a queue so that it becomes eligible to be received by a queue receiver (with message selector). ??


        • 1. Re: Changing Message Properties
          Peter Antman Expert

          Do you mean when it is in the queue? No.

          But you can pop if from the queue, change properties and stuff it in again, here is som code from org.jboss.ejb.plugins.jms.DLQHandler that helps doing that:

          protected Message makeWritable(Message msg) throws JMSException
          Hashtable tmp = new Hashtable();
          // Save properties
          for(Enumeration en = msg.getPropertyNames();en.hasMoreElements();)
          String key = (String) en.nextElement();
          // Make them writable

          Enumeration keys = tmp.keys();
          String key = (String) keys.nextElement();
          return msg;