Monday, September 26, 2011

WLST delete messages from a Queue/Topic

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



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


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: