1 Reply Latest reply on Sep 16, 2007 4:10 AM by Aaron Walker

    How to obtain getMessageCounters for a Topic

    Leon Vogelzang Newbie

      From my application I?m publishing messages to the testTopic topic.
      This application is not running under Jboss.

      Does anyone know how I can obtain the Message counters ... getMessageCounters() for a given topic?
      See:

      http://labs.jboss.com/file-access/default/members/jbossmessaging/freezone/docs/javadoc/api-1.4.0.CR1/org/jboss/jms/server/destination/TopicService.html#getMessageCounters()


      As base I'm using the out of the box jboss-4.2.1.GA installation without ANY configuration change.

      In the file:
      \jboss-4.2.1.GA\server\default\deploy\management\console-mgr.sar\web-console.war\TopicSubscriptions.jsp
      Is almost what I needed.
      Almost since this page return exceptions.
      (If it works I can reformat the output to XML)

      Try:
      http://localhost:8080/web-console/TopicNavigation.jsp?ObjectName=testTopic

      And click subscriptions.



      per.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspTagException: javax.management.MalformedObjectNameException: Key properties cannot be empty
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:535)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      root cause

      javax.servlet.ServletException: javax.servlet.jsp.JspTagException: javax.management.MalformedObjectNameException: Key properties cannot be empty
      org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)
      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
      org.apache.jsp.TopicSubscriptions_jsp._jspService(TopicSubscriptions_jsp.java:208)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      root cause

      javax.servlet.jsp.JspTagException: javax.management.MalformedObjectNameException: Key properties cannot be empty
      org.jboss.console.plugins.helpers.servlet.MBeanTag.doStartTag(MBeanTag.java:95)
      org.apache.jsp.TopicSubscriptions_jsp._jspService(TopicSubscriptions_jsp.java:77)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


      If JMX is the only solution, does somebody has a piece of example code?

      Thanks for any help

        • 1. Re: How to obtain getMessageCounters for a Topic
          Aaron Walker Newbie

          BTW the Forum is for Design questions for the JBoss Messaging implementation. Please post these types of questions on the user forums.

          That said

          You can invoke any JMX MBean remotely by simply looking up the RMIAdaptor in JNDI.

          Here's some sample code for doing this

          
           String connectorName="jmx/rmi/RMIAdaptor";
          
           RMIAdaptor server = (RMIAdaptor) new InitialContext().lookup(connectorName);
          
           ObjectName monitorName = new ObjectName("Monitor:name=JBossMonitor");
          
          
          
           Object[] params = {};
          
           String[] signature = {};
          
           String history = (String) server.invoke(monitorName, "history", params, signature);
          
           System.out.println("Invoked JBossMonitor.history:");
          
           System.out.println(history);
          


          Check the JBoss Microkernel wiki http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossMicrokernel for more info as well as the JBoss AS docs