Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Help with JBossMQ: List running messages

Help
2007-07-13
2013-04-24
  • Hi all,

    HermesJMS was a great help in figuring out how to list queues in the JBoss and their messages. However it seems that using the QueueBrowser created by a Session will not list the Messages that are currently running. Does anyone know of a possibility to do this?

    Any help very much appreciated.

    Best regards
    Alex

     
    • Hi again,

      acutally it seems that very often I don't get the right listing, it is rather occasional that some messages pop out of this code:

      List<Message> msgs = new ArrayList<Message>();
      InitialContext initialContext = SecurityReflector.createInitialContext();
      QueueConnectionFactory connectionFactory = JMSConnectionFactoryLookup.lookupQueueConnectionFactory(initialContext);
      Connection connection = connectionFactory.createConnection();
      Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
      QueueBrowser queueBrowser = session.createBrowser(queue);
      Enumeration en = queueBrowser.getEnumeration();
      while (en.hasMoreElements()) {
          Object el = en.nextElement();
          if (el instanceof Message) {
              msgs.add((Message) el);
          }
      }
      return msgs;

      Does anyone know how to get 'more' messages from JBossMQ.
      I've experimented with about 100 messages in 4 queues. They all produce errors and I've set redelivery timeout to 10s. However still when obiously no message is processed the QueryBrowser won't give me any entries :-(

      Best regards
      Alex

       
    • Hi again,

      sorry for the 'stupid' question. Rtfm and see that the session could also be NON-transacted:

      // Create a not transacted session, set the 1st parameter to false
      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

      The QueueBrowser obtained from such a session provides a lot more information ...

      Best regards,
      Alex