This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes List Durable Subscriptions from JMS Topic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "List Durable Subscriptions from JMS Topic" Watch "List Durable Subscriptions from JMS Topic" New topic
Author

List Durable Subscriptions from JMS Topic

Srinivas Katta
Ranch Hand

Joined: Feb 01, 2007
Posts: 76
Hi,

We have a requirement to list all the durable subscriptions from the JMS topic and written below code to get the Topic name

Topic topic = null;
Properties p = new Properties( );
p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES," org.jboss.namingrg.jnp.interfaces");

Context ctx = new InitialContext(p);

// Locate the Topic Connection Factory via JNDI
TopicConnectionFactory factory =
(TopicConnectionFactory) ctx.lookup(
"ConnectionFactory");

try
{
topic = (Topic) ctx.lookup("/topic/AB_MessageStore");
System.out.println("Topic Name:" + topic.getTopicName());
}
catch (NameNotFoundException exc)
{
exc.printStackTrace();
System.out.println("AB_MessageStore Topic not found");
}

Please let me know if anybody have any idea to list the subscriptions in that topic

Thanks
Srinivas

E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 873
    
    9
First, you can probably view them on the console as explained here http://docs.oracle.com/cd/E14571_01/apirefs.1111/e13952/pagehelp/JMSjmssubscribersjmsdurablesubscriberruntimetitle.html

From code you might need to use JMX to query the JMSServerRuntimeMBean and JMSDurableSubscriberRuntimeMBean which are described here http://docs.oracle.com/cd/E23943_01/apirefs.1111/e13951/core/index.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: List Durable Subscriptions from JMS Topic
 
Similar Threads
JMS and client application
Failed to initialize the ORB using websphere.
Question on MessageDriven Beans
does JBoss ship with a predefined TopicConnectionFactory?
Durable Subscription