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 TPublisher.java (puts the messages in the topic) and TSubscriber.java (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 TPublisher.java. 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
Joined: Jan 04, 2006
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.