www.michalscorner.com what I have recently discovered

24Feb/103

how to check JMS queue depth using jacl

Recently I was asked how to check JMS queue depth on WAS so, I thought it might be worth sharing it . Answer below

Case 1: check depth of 1 particular queue

set qpoint "WebSphere:*,type=SIBQueuePoint,name=MyQueuePointName"
set queues [$AdminControl queryNames $qpoint]
foreach q $queues {
set identifier [$AdminControl getAttribute $q identifier]
set size [$AdminControl getAttribute $q depth]
puts "$identifier size: $size messages"
puts [$AdminControl getAttributes $q]
}

Case 2: check all the queue points

set qpoint  "WebSphere:*,type=SIBQueuePoint"
set queues [$AdminControl queryNames  $qpoint]
foreach q $queues {
set identifier [$AdminControl  getAttribute $q identifier]
set size [$AdminControl getAttribute $q  depth]
puts "$identifier size: $size messages"
puts  [$AdminControl getAttributes $q]
}

I hope this helps

10Dec/090

how to clean messaging queue using jython

Objective for yesterday: Clean Persistent messages from JMS queue.

There are few methods that will work depending on your messaging set-up. I ill show how to clean persistent messages from the queue using wsadmin and jython.

First of all localize wsadmin tool on your host. It is located in <install_root>/AppServer/bin

cd <install_root>/AppServer/bin

Create new file called cleanJMSQueue.py on your host machine with the following content. [Remember to replace variables with appropriate values matching your environment]

objName = AdminControl.makeObjectName('WebSphere:type=SIBQueuePoint,SIBMessagingEngine=MyNode.MyServer-MyBus,name=MyQueueName,*')
qps = AdminControl.queryNames_jmx(objName, None)
qp = qps[0]
AdminControl.invoke_jmx(qp, 'deleteAllQueuedMessages', [java.lang.Boolean('false')], ['java.lang.Boolean'])

Start wsadmin tool to connect to deployment manager and execute script

wsadmin.sh -host <dmgr_server> -port <dmgr_SOAP_port> -conntype SOAP -username <admin_username> -password <admin_password> -lang jython -f <location_cleanJMSQueue.py>