WebSphere‎ > ‎


IBM WebSphere SOA supporting environment available on WebSphere Process Server(WPS). Admnistration of WPS application servers need to handle overloaded the failed events. When the flat files are processed by WPS server there could be chances of getting Failed Events. When WPS processing huge size of flat files, expected Failed Events are more. Most of the QA/Test environment might be filled up with thousands of failed events. That could lead to slowness of the service on WPS. As Middleware administrator you need to clean up these Failed events. 

Automation with Jython scripting for WPS servers administration

How Jython script works for WPS?

The Jython script perform the following steps:
Jython Failed Event Sweeper WPS
  1. Connect to the Deployment Manager from the command line arguments.
  2. Using AdminControl object, lookup for the failed events thru the FailedEventManager
  3. Fetch the Failed event count and print the count
  4. We cannot discard all the failed events in one go, we may encounter Timedout errors. So we need to run this script multiple times until we get the failed events count as zero.
  5. Using JMX mbean get the failed events list into a variable.
  6. Discard the failed events in a single batch run
  7. At the end confirm with the new failed event count, that reveals howmany failed events remaining on WPS environment.
Create a Jython script using text editor (vi/vim) with the file name as DelFailedEvnts.py and enter the code lines as given below:

# This Jython script for removal of WPS Failed Events 

# lookup the failed event manager
objstr = AdminControl.completeObjectName( 'WebSphere:*,type=FailedEventManager')
obj = AdminControl.makeObjectName(objstr)
# count the overall number of failed events
fecount = AdminControl.invoke(objstr,"getFailedEventCount")
print "Before discarding failed events", fecount

# get failed events
msglist = AdminControl.invoke_jmx(obj,'getAllFailedEvents',[3500],['int'])
# discard  events in single batch run
print "Discarding  failed events"
AdminControl.invoke_jmx(obj,'discardFailedEvents',  [msglist],['java.util.List'])
# count the overall number of failed events
aftrCnt = AdminControl.invoke(objstr,"getFailedEventCount")
print "After discarding failed events", aftrCnt
except Exception, e:
print "Error", e 

Invoking JYTHON script for WPS/WebSphere

Where should I run this? how should run? don't worry just follow the below commands:
wsadmin.sh -lang jython -f delFailedEvts.py -user <username> -password <password>
On Windows platform you can execute the same Jython script.
wsadmin -lang jython -f delFailedEvts.py -user <username> -password <password>
The execution looks like this:
WASX7209I: Connected to process "dmgr" on node  CellManager01 using SOAP connector;  The type of process is: DeploymentManager
WASX7026W: String "WebSphere:*,type=FailedEventManager" corresponds to 2 different MBeans; returning first one.
Before discarding failed events 19243
Discarding  failed events
After discarding failed events 15743

Keep visiting the site we are looking for your valuable comments and suggestions.
Pavan Devarakonda,
Apr 23, 2012, 10:57 PM