This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes JMS Durable Subscriber Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS Durable Subscriber" Watch "JMS Durable Subscriber" New topic

JMS Durable Subscriber

K Kiran Kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 109

I am developing a sample JMS application. I am using IBM WAS 7.0. I am using the default message provider of WAS as the JMS provider.
The application has (puts the messages in the topic) and (reads the message from the topic).

I have configured the SIB, Topic, Topic Connection Factory (standalone application to access the topic) and activation specifications (for MDB to access the topic). I was able to create a durable MDB subscriber by defining the clientID and subscription name in the activation specifications. I am also successful in creating a non-durable standalone consumer.

I want to create a durable subscriber from the standalone application that consumes my I know I have to play around clientID and subscriber name but not sure what needs to be done.

My question is where to define clientID and subscriber name in the
(1) standalone publisher program (if any)
(2) where and what to configure in the admin console of WAS 7
(3) what to add in the consumer program so that my standalone consumer becomes a durable one.

I tried giving the clientID ("durableIDCF") in the topic connection factory (in the admin console) and used the below code in the consumer.
session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
topicsubscriber = session.createDurableSubscriber(topic,"mySub"); // not sure where else to initiate/define the subscriber name of "mySub"

However, I get the below error. I tried googling but didn't get a clue as what needs to be done. Any help would be greatly appreciated.
javax.jms.IllegalStateException: CWSIA0023E: The client ID for this connection is read-only.

K Kiran Kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 109

I found the solution. Donot use connection.setClientID("durableIDCF"); in the subscriber code as the clientID already exists i.e., in the connection factory the client was already defined. So I was trying to define it again and its failing. So summary is
(1) Dont do anything in the publisher
(2) Define the clientID in the Connection Factory
(3) Give some unique name to the subscription name in the subscriber code.

I agree. Here's the link:
subject: JMS Durable Subscriber
Similar Threads
JMS CommunicationException
Multiple Entries in sun-ejb-jar.xml for Message Driven Bean?
JMS Durable Subscriber Example
why not durable subscriber on queue, and more?
Give authorization on Jms