Deleting failed events using the failed event manager MBean and a Jython script with WebSphere Process Server (WPS)

Technote (FAQ)


Question

You want to delete a large number of failed events using a script and a batch run. How can use a Jython script to accomplish this task?

Answer

The following Jython script uses the failed event manager application programming interface (API) and the related MBean to delete failed events in a batch run:

# 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"
print fecount

# get 100 failed events
msglist = AdminControl.invoke_jmx(obj,'getAllFailedEvents',[100],['int'])

# discard 100 events in single batch run
print "Discarding 100 failed events"
AdminControl.invoke_jmx(obj,'discardFailedEvents',
  [msglist],['java.util.List'])

# count the overall number of failed events
fecount2 = AdminControl.invoke(objstr,"getFailedEventCount")
print "After discarding failed events"
print fecount2

The script must be saved in a file and can be run on a single server profile as well as a clustered environment (run on deployment manager) using the following command:

profileName/bin/wsadmin.(bat|sh) -lang jython -f jythonScriptName -user wpsAdminUserName -password wpsAdminPassword


Related information

How to delete a large number of failed events?

Product Alias/Synonym

WPS

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

WebSphere Process Server
Failed Events

Software version:

6.1.2, 6.2, 7.0

Operating system(s):

AIX, HP-UX, Linux, Linux zSeries, Solaris, Windows, z/OS

Reference #:

1515275

Modified date:

2013-04-15

Translate my page

Machine Translation

Content navigation