Thursday, September 29, 2011

WLST deleting Durable Subscribers

I was following Kathiravan excellent document http://jeanfrancoisoracle.free.fr/Tools/JMS_Message_Management.doc

to delete durable subscribers in WLST,
slightly modified here to delete ALL durable subscribers:

# connect to the server
connect(‘weblogic’,’weblogic’,’t3://localhost:7001’)

# navigate to the root of the server’s Runtime MBean tree
serverRuntime()

# navigate to the JMSRuntime
cd(‘JMSRuntime/myserver.jms’)

# navigate to the JMSServer that the queue is on
cd(‘JMSServers/MyJMSServer1’)

# navigate to “MyTopic1” where the durable subscriber will be created
cd (‘Destinations/MyJmsSystemResource!MyTopic1’)

# get all the durable subscriber runtime MBeans on this topic
# note that this operation would return an array of dsub runtimes
dsubs1=cmo.getDurableSubscribers()

# then pass it as an argument to the delete method as below
for ds in dsubs1:
    try:
        cmo.destroyJMSDurableSubscriberRuntime(ds)
    except:
        print "Unexpected error:", sys.exc_info()[0]
 




If the Durable Subscriber is active, you get this error:


weblogic.jms.common.JMSException: Active topicSubscriber is using this subscription right now
at weblogic.jms.backend.BEConsumerImpl.delete(BEConsumerImpl.java:968)
at weblogic.jms.backend.BEDurableSubscriberRuntimeMBeanImpl.destroy(BEDurableSubscriberRuntimeMBeanImpl.java:121)
at weblogic.jms.backend.BEDestinationRuntimeMBeanImpl.destroyJMSDurableSubscriberRuntime(BEDestinationRuntimeMBeanImpl.java:85)



so make sure you kill the Durable Subscriber process before deleting its subscription.... I wish there was a better way...

2 comments:

Sapp said...

Great site! Could you maybe explain how to kill the active Subscriber? We have the problem, that Subscriber, which were deleted in OSB are still active on a topic.
Thanks!

vernetto said...

I am sorry Sapp, I have looked in my notes but could not find anything