Monday, September 26, 2011

WLST delete messages from a Queue/Topic

connect('weblogic', 'weblogic', 't3:localhost:7001')
serverRuntime()

cd('/JMSRuntime/ManagedServer1.jms/JMSServers/JMS_SRVR_Man01/Destinations/MyJMSModule!JMS_SRVR_Man01@MyDistributedTopic')

cmo.deleteMessages('')


java.lang.UnsupportedOperationException: java.lang.UnsupportedOperationException: deleteMessages(String) not valid for class weblogic.jms.backend.BEDestinationRuntimeMBeanImpl



WTF???

In fact, BEDestinationRuntimeMBeanImpl extends BEMessageManagementRuntimeDelegate, and it's BEMessageManagementRuntimeDelegate who implements
public Integer deleteMessages(String selector)

BEDestinationRuntimeMBeanImpl implements JMSDestinationRuntimeMBean, which doesn't expose the deleteMessages method.

It could very well be that WLST evaluates the Interface, not the Implementation of the cmo...

In fact, when you deleteMessages from WebLogic console, it's directly the weblogic.jms.backend.BEMessageManagementRuntimeDelegate.deleteMessages() which is invoked, and not the BEDestinationRuntimeMBeanImpl.


The same API works for a Queue, but NOT for a Distributed Topic.

PS I have tested on 10.3.4 and the same problem is present.
Workaround: delete all durable subscribers and the messages should disappear :o(((

No comments: