1 Reply Latest reply on Mar 21, 2002 12:17 AM by Hiram Chirino

    getting a message from the queue with id in selector

    Joost Wijgerd Newbie

      Hi,

      I have a QueueBrowser that is polling a queue. I display this queue in a Swing client. When the user takes an action I want to get the message from the queue, so I make a selector based on the JMSMessageID. Unfortunately this doesn't seem to work.. can somebody tell me what I'm doing wrong? Below is a code snippet..

      thanx,

      Joost


      String selector = "JMSMessageID='" + msg.getJMSMessageID() + "'";
      // fetch it from the queue
      QueueReceiver receiver = session.createReceiver(queue,selector);
      msg = receiver.receiveNoWait();
      if(msg != null) {
      // ok .. we have it put it in some other list
      System.out.println("Got Message");
      } else {
      // @todo: show dialog
      System.out.println("Message not available anymore");
      }
      // close the receiver
      receiver.close();