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..
| }
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036447#4036447
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036447
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user