Saturday, October 25, 2014

Manage JMS queues on IBM Websphere 7.1 using JACL

We observe sometimes that, the JMS Messages go into a infinite processing mode,  where the same messages gets repeatedly processed by the MDB, and the only way to stop it - is by removing the message from the JMS Queue.

The IBM Websphere interface for removing the message from queue is not so user friendly. It can be done either through the python script or the JACL.

Below are the simple steps to be followed to manqage JMS Queues in Websphere -

To get depth of all queues -

# List all queues/Depth of queues
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] }


To get depth of a particular queue - 

#List number of Messages in a Queue
./wsadmin.sh -user system -password password -conntype SOAP -port 10505

set qpoint "WebSphere:type=SIBQueuePoint,SIBMessagingEngine=TestNode01.server-server_ILS_QUEUE_CONNECTOR.sib,name=app_DEFAULT_JMS_DLQ,*"
set queues [$AdminControl queryNames $qpoint]
set identifier [$AdminControl getAttribute $queues identifier]
set size [$AdminControl getAttribute $queues depth]
puts "$identifier size: $size messages"
puts [$AdminControl getAttributes $queues]

To clear all JMS Messages from a queue -

#Delete messages from Queue
set qstring "WebSphere:type=SIBQueuePoint,SIBMessagingEngine=TestNode01.server-server_ILS_QUEUE_CONNECTOR.sib,name=app_DEFAULT_JMS_DLQ,*"
#set qobject [$AdminControl makeObjectName $qstring]
#set null [java::null]
set queriedobject [$AdminControl queryNames $qstring]
set params [java::new {java.lang.Object[]} 1]
$params set 0 false
$AdminControl invoke $queriedobject deleteAllQueuedMessages $params

Command for Admin Control - 

http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp?topic=/com.ibm.websphere.iseries.doc/info/ae/ae/rxml_admincontrol.html


No comments:

Post a Comment