2 Replies Latest reply on Jul 22, 2009 1:05 AM by Yong Hao Gao

    browsing the queue message in chunks/page wise

    raj jha Newbie

      My queue is deployed using jboss messaging with PageSize configured as 1000. I am using the following code to browse the messages on queue

      QueueBrowser browser = session.createBrowser(queue);
      connection.start();
      Enumeration msgs = browser.getEnumeration();
      int count = 0;
      if ( !msgs.hasMoreElements() ) {
      System.out.println("No messages in queue");
      } else {
      while (msgs.hasMoreElements()) {
      count++;
      TextMessage tempMsg = (TextMessage)msgs.nextElement();
      System.out.println("Message: " + tempMsg.getText());
      }