posted 11 years ago
Hi,
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);
connection.setClientID("durableIDCF");
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.
at com.ibm.ws.sib.api.jms.impl.JmsConnectionImpl.setClientID(JmsConnectionImpl.java:431)
Regards,
Kiran.