File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes JMS Durable Subscriber Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS Durable Subscriber Example" Watch "JMS Durable Subscriber Example" New topic
Author

JMS Durable Subscriber Example

Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 248
Hi,
Please does anyone have a durable subscriber example in jms through which I can clear my concepts ?. I have understood the theory, but I would like to have a code example through which I can clear my concepts. Where does clientID figure in the code and how is it used in durable subscriber example ? Please do explain me. I am using JBoss 5.0.0-G.A. application server. Any help would be highly appreciated.

Thanks.
Shane Lee
Ranch Hand

Joined: Mar 19, 2005
Posts: 63
check out this article on ibm developer works, it explains why you need clientId:
IBM Websphere Technical Journal
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 248
Hi,
I read this article. I read the description of ClientID but I still didn't get where clientID is used in the code. Please help me understand wherein the code do we use clientID.

I am using JBoss-5.0.0GA as my app. server. I have set the client ID in the <mbean> tag in the file connection-factories-service.xml. Now I didn't get where do we use the client ID in durable subscription code. Please help me understand this. Thanks.

Shane Lee
Ranch Hand

Joined: Mar 19, 2005
Posts: 63
You set the client id in your jms connection. For my example i am using websphere MQ 7.0 as my jms messaging provider and my enterprise application is deployed on WAS 6.1, so i set the client id on my mq connection factory properties. My durable subscriber MDB then looks up this connection factory as an administered object.

Hope that makes sense.
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 248
Is clientID same as subscription name ?
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 248
Any update on this query ???
Shane Lee
Ranch Hand

Joined: Mar 19, 2005
Posts: 63
For a durable subscritpion you need combination of topic name, clientId and subscriber name. When you create your TopicSubscriber from your jms session you need to provide your topic and a name for the subscriber. This uniquely identifies the subscriber to the topic.

See http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/TopicSession.html#createDurableSubscriber(javax.jms.Topic,%20java.lang.String)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMS Durable Subscriber Example
 
Similar Threads
Durable Subscriber Problem
question about durable JMS subscription.
Doubt in JMS pub/sub model
Problem in using durabl subscribers
Doubt in JMS pub/sub model