This content has been marked as final.
Show 4 replies
-
1. Re: Number of topic subscriptors
mskonda Apr 11, 2007 12:20 PM (in response to rolmovel)You mean subscriptions, right?
Go to the JNDIView of the relevant Topic and invoke listAllSubscriptions() to get the list of all subscriptions.
Thanks
Madhu -
2. Re: Number of topic subscriptors
rolmovel Apr 11, 2007 12:35 PM (in response to rolmovel)Thank you very much, how can i do it programaticly?
Thanks again... -
3. Re: Number of topic subscriptors
mskonda Apr 11, 2007 12:47 PM (in response to rolmovel)Here's the method that would do what you need.
private void testSubscriptionsList(String destName, String type) throws Exception { QueueMBean queueMBean = null; TopicMBean topicMBean = null; try { //find the mbean server mBeanServer = (MBeanServerConnection) new InitialContext().lookup("jmx/invoker/RMIAdaptor"); // create the relevant ON // Here type equals to Queue or Topic and // destName equals to name of the destination, for example testTopic serverObjectName = new ObjectName( "jboss.messaging.destination:service=" + type + ",name=" + destName); // create either queueMBean or topicMBean if (type.equalsIgnoreCase("Queue")) { queueMBean = (QueueMBean) MBeanServerInvocationHandler .newProxyInstance(mBeanServer, serverObjectName, QueueMBean.class, false); } else if (type.equalsIgnoreCase("Topic")) { topicMBean = (TopicMBean) MBeanServerInvocationHandler .newProxyInstance(mBeanServer, serverObjectName, TopicMBean.class, false); } } catch (NamingException e) { logger.warn("NamingException:" + e.getMessage()); logger.error(e); } catch (Exception e) { logger.info("Exception:" + e.getMessage()); logger.error(e); } // once you get the relevant MBean, invoke // the appropriate operations. // For example, to list the subscription on the topic // do this: List subs = topicMBean.listAllSubscriptions(); // iterate through the list.. }
-
4. Re: Number of topic subscriptors
rolmovel Apr 11, 2007 12:57 PM (in response to rolmovel)thank you very much...