Showing posts with label JMS. Show all posts
Showing posts with label JMS. Show all posts

Tuesday, February 26, 2013

Delete Messages from JMS Queue in weblogic using WLST


Set classpaths required for WLST from MW_HOME/wlserver_10.3/server/bin/
. ./setWLSEnv.sh
start WLST by typing
java weblogic.WLST

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

cd('/JMSRuntime/<TargetServerName>.jms/JMSServers/<JMSServerName>/Destinations/<JMSModuleName>!<QueueName>')

{ex.- wls:/fmw_domain/serverRuntime>cd('/JMSRuntime/AdminServer.jms/JMSServers/JMSServer1/Destinations/SystemModule1!Queue1')
}

cmo.deleteMessages('')
{This command delete all messaged in queue and will return the number of messages deleted.}

If you want to delete a particular message from the queue, use below command:

cmo.deleteMessages("JMSMessageID IN('ID:<126965.1361894150054.0>')")
Results will be:
1
It will delete a message having id ID:<126965.1361894150054.0>
here is the message ID which we can get from "summary of JMS Message" from Admin Console.