Delete Messages From JMS Queue Using WLST

Connect to the server using WLST by entering the command java weblogic.WLST
Enter the command connect()
Enter the username, password, and the admin server url you want to connect to.

Change the location to serverRuntime by entering the command serverRuntime().
Traverse to the below location:
– cd(‘JMSRuntime’)
– cd(‘AdminServer.jms’)
– cd(‘JMSServers’)
– cd(‘FEJMSServer’)
– cd(‘Destinations’)
– cd(‘FRModule!FRQ’)
– ls()

It shows all the attributes and functions of Queue1.

wls:/lab_domain/serverRuntime/JMSRuntime/AdminServer.jms/JMSServers/FEJMSServer/Destinations/FRModule!FRQ> ls()
dr–   DurableSubscribers

-r–   BytesCurrentCount  11
-r–   BytesHighCount  11
-r–   BytesPendingCount  0
-r–   BytesReceivedCount 0
-r–   BytesThresholdTime  0
-r–   ConsumersCurrentCount 0
-r–   ConsumersHighCount  0
-r–   ConsumersTotalCount  0
-r–   ConsumptionPaused   false
-r–   ConsumptionPausedState  Consumption-Enabled
-r–   DestinationInfo

-r–   DestinationType  Queue
-r–   DurableSubscribers  null
-r–   InsertionPaused  false
-r–   InsertionPausedState  Insertion-Enabled
-r–   MessagesCurrentCount  3
-r–   MessagesDeletedCurrentCount  0
-r–   MessagesHighCount  3
-r–   MessagesMovedCurrentCount  0
-r–   MessagesPendingCount  0
-r–   MessagesReceivedCount 0
-r–   MessagesThresholdTime  0
-r–   Name   FRModule!FRQ
-r–   Paused  false
-r–   ProductionPaused  false
-r–   ProductionPausedState   Production-Enabled
-r–   State  advertised_in_cluster_jndi
-r–   Type   JMSDestinationRuntime

-r-x   closeCursor  Void : String(cursorHandle)
-r-x   deleteMessages   Integer : String(selector)
-r-x   getCursorEndPosition     Long : String(cursorHandle)
-r-x   getCursorSize  Long : String(cursorHandle)
-r-x   getCursorStartPosition  Long : String(cursorHandle)
-r-x   getItems[] : String(cursorHandle),Long(start),Integer(count)
-r-x   getMessage : String(cursorHandle),Long(messageHandle)
-r-x   getMessage : String(cursorHandle),String(messageID)
-r-x   getMessage : String(messageID)
-r-x   getMessages   String : String(selector),Integer(timeout)
-r-x   getMessages   String : String(selector),Integer(timeout),Integer(state)
-r-x   getNext[] : String(cursorHandle),Integer(count)
-r-x   getPrevious[] : String(cursorHandle),Integer(count)
-r-x   importMessages  Void :[],Boolean(replaceOnly)
-r-x   moveMessages  Integer : String(java.lang.String),,Integer(java.lang.Inte
-r-x   moveMessages   Integer : String(selector),
-r-x   pause   Void :
-r-x   pauseConsumption   Void :
-r-x   pauseInsertion  Void :
-r-x   pauseProduction  Void :
-r-x   preDeregister  Void :
-r-x   resume  Void :
-r-x   resumeConsumption  Void :
-r-x   resumeInsertion  Void :
-r-x   resumeProduction  Void :
-r-x   sort   Long : String(cursorHandle),Long(start),String[](fields),Boolean[](ascending)

For deleting messages, type the below command:

wls:/lab_domain/serverRuntime/JMSRuntime/AdminServer.jms/JMSServers/FEJMSServer/Destinations/FRModule!FRQ> cmo.deleteMessages(“JMSMessageID IN(‘ID:<840637.1277114817339.0>’)”)
Results will be:
It will delete a message having id ID:<840637.1277114817339.0>

Latest Comments

  1. MpkBang May 10, 2011
    • divya August 5, 2011

Leave a Reply