• Post Reply Bookmark Topic Watch Topic
  • New Topic

Read the JMS Queue subscriber count

 
Alfred C. Thomas
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I need a way to read the number of subscribers on a JMS queue in JBoss. The class org.jboss.mq.server.jmx.Queue Does have a getSubscriberCount() but I get a clas-cast exception when I try to cast the Queue object to this type (The class I get is a SpyQueue).
Does anyone have any ideas?

Regards
Alfred
[ November 06, 2006: Message edited by: Alfred C. Thomas ]
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the code that you are using to do this
 
Alfred C. Thomas
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating the queue as follows:

RMIAdaptor server = (RMIAdaptor)initialContext.lookup("jmx/invoker/RMIAdaptor");
ObjectName destinationManager = new ObjectName("jboss.mq:service=DestinationManager");
server.invoke(destinationManager, "createQueue", new Object[] { queueName, queueName }, new String[] { String.class.getName(), String.class.getName()});
Object queueObject = initialContext.lookup(queueName);
System.out.println(queueObject.getClass().getName());
Queue queue = (Queue)queueObject;

The queue in this case is a javax.jms.Queue which doesn't have a subscriberCount
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:


[ November 07, 2006: Message edited by: Jaikiran Pai ]
 
Alfred C. Thomas
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaikiran

Thanks that worked.

Regards Alfred
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!