8 Replies Latest reply on May 30, 2007 8:17 AM by Tim Fox

    Listing JMS Messages using JMX doesn't give full message

    mskonda Apprentice

      I have developed set of tools to "browse" messages on destinations for Kabutar. The approach I've taken is to use JBoss JMS MBeans rather than clumsy JMS QueueBrowser.

      I am able to create/fetch the MBean responsible for the destination of my interest, however, when I try to have a peek at the message content, I don't get anything except printing:



      I get null when I tried getting the text (after convesion to TextMessage) from the message.

      here's my test code:

       public void testQueueInfo() throws Exception
       String name = "testSecuredQueue";
       logger.info("Deploying the queue - " + name);
       MBeanServerConnection mBeanServer = lookupMBeanServerProxy(new InitialContext());
       ObjectName serverObjectName = new ObjectName(
       "jboss.messaging.destination:service=Queue,name=" + name);
       ArrayList o = (ArrayList) mBeanServer.invoke(serverObjectName,
       "listAllMessages", new Object[0], new String[0]);
       for (Iterator i = o.iterator(); i.hasNext();)
       Message msg = (Message)i.next();
       logger.info("Message: " + msg);
       TextMessage txtMsg = (TextMessage)msg;
       logger.info("TxtMessage: " + txtMsg.getText());

      The same happens when you access litAllMessages method via JMX Browser

      Any pointers?