How to purge/delete message from weblogic JMS queue

weblogic-10.x

Solution

Here is an example in WLST for a Managed Server running on port 7005:

connect('weblogic', 'weblogic', 't3://localhost:7005')
serverRuntime()

cd('/JMSRuntime/ManagedSrv1.jms/JMSServers/MyAppJMSServer/Destinations/MyAppJMSModule!QueueNameToClear')

cmo.deleteMessages('')

The last command should return the number of messages it deleted.

Problem

Is there and way (apart from consuming the message) I can purge/delete message programmatically from JMS queue. Even if it is possible by wlst command line tool, it will be of much help.

Original source