xufang [
http://community.jboss.org/people/xufang] created the discussion
"How to enable auto-generated ClientID when creating durable subscription for a JMS
Topic?"
To view the discussion, visit:
http://community.jboss.org/message/563015#563015
--------------------------------------------------------------
Hi All,
I met a JMS problem when recently upgraded to JBoss 5.1.0GA from JBoss 4.0.3SP1.
When using JBoss 4.0.3SP1, JBossMQ can create a unique ClientID automatically when
creating a durable subscription for a JMS topic if no clientID specified. The code is as
below:
Context jndiContext=this.createInitContext(this.initFile);
TopicConnectionFactory topicConnectionFactory =
(TopicConnectionFactory)jndiContext.lookup("ConnectionFactory");
Topic topic = (Topic)
jndiContext.lookup("topic/"+this.initFile.getTopicName());
topicConnection=topicConnectionFactory.createTopicConnection();
topicSession = null;
if (this.initFile.getClientID()==null ||
"".equals(this.initFile.getClientID()))
{
topicSession=topicConnection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
this.initFile.setClientID(topicConnection.getClientID());
}
After topicConnection.createTopicSession, a ClientID will be created by JBossMQ and by
calling topicConnection.getClientID(), the clientID can be got and stored locally.
But after upgraded to JBoss 5.1.0GA which is using JBossMessaging, the above code is not
working any more. TopicConnection.getClientID() always return null. I must specify the
ClientID explicitly otherwise the subscription cannot be successful.
I am wondering how can I enable the ClientID auto-generated function in JBoss 5.1.0GA.
Please enlighten me.
Thanks & Best Regards,
Xu Fang
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/563015#563015]
Start a new discussion in JBoss Messaging at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]