Weblogic jms distributed topic

2.1k views Asked by At

Using java application, I'm trying to create a durable subscription on a jms uniform distributed topic.

The jms server is running on weblogic 10.3.5 and the topic is distributed on 2 servers.

If I'm developping a message driven bean, it's working. I have a durable subscription on both servers with the same subscription name.

With a standalone java application, I can do the job with a normal topic (not distributed). But can't manage it to work with distributed topic.

InitialContext ic = new InitialContext();
TopicConnectionFactory connectionFactory = (TopicConnectionFactory) ic.lookup("myConnectionFactory");
TopicConnection connection = connectionFactory.createTopicConnection();
connection.setClientID("testclient");
TopicSession session = connection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
TopicSubscriber subscriber;
Topic topic1 = (Topic) ic.lookup("jmsserver1@myTopic");
Topic topic2 = (Topic) ic.lookup("jmsserver2@myTopic");
subscriber = session.createDurableSubscriber(topic1,"testSubscription","",false);
subscriber = session.createDurableSubscriber(topic2,"testSubscription","",false);

Gives me

Exception in thread "main" weblogic.jms.common.JMSException: [JMSClientExceptions:055037]Subscription testSubscription is in use

In the weblogic console the first subscription testSubscription on myJmsModule!jmsserver1@myTopic is created not the second.

What can I do ?

2

There are 2 answers

0
Anish V P On

You will have to remove the durable subscription manually and WLS will not remove to automatically

https://docs.oracle.com/cd/E17904_01/web.1111/e15493/dist_topics.htm#WLMDB10013

Setting Automatic Deletion of Durable Subscriptions :-

You can configure an MDB to automatically delete a durable topic subscription when the MDB is undeployed or deleted from a server. To configure an MDB to automatically delete durable topic subscriptions, set durable-subscription-deletion to True. By default, durable-subscription-deletion is set to False

By default it is false and thus it will not clear the durable subscriber automatically.

0
dan carter On

You need to change the ConnectionFactory via the weblogic admin console to create shareable connections

Client ID Policy: CLIENT_ID_POLICY_UNRESTRICTED
Subscription Sharing Policy:Sharable

https://docs.oracle.com/cd/E57014_01/wls/WLACH/pagehelp/JMSjmsconnectionjmsconnectionfactoryconfigclientparamstitle.html