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

    Changing Message Properties

    puneet

      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). ??

      Puneet

        • 1. Re: Changing Message Properties

          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();
          tmp.put(key,msg.getStringProperty(key));
          }
          // Make them writable
          msg.clearProperties();

          Enumeration keys = tmp.keys();
          while(keys.hasMoreElements())
          {
          String key = (String) keys.nextElement();
          msg.setStringProperty(key,(String)tmp.get(key));
          }
          return msg;
          }

          //Peter