About Me

About Me
Working with SOA technologies , implementing solution using IBM BPM , IBM Integration Designer,IBM WODM and IBM DataPower

About me

View Mahesh Dondeti's profile on LinkedIn

upcoming posts on IBM Bluemix,Devops,Worklight,Node js.

Tuesday 24 November 2015

Deleting Failed events in IBM BPM Advanced v8.5



                           Deleting Failed events in IBM BPM Advanced 

The Failed Event Manager can get filled up with thousands of failed events, especially in a development or test environment.  Using the admin console you can delete these events, however you are limited to delete a maximum of 500 per occurrence.  This limitation is to prevent the JVM from crashing by attempting to delete too many failed events at a time.  If you have thousands of events to delete- this can be difficult task to perform in the admin console.
wsadmin provides an API to determine the number of failed events and remove a configurable number of failed events in a single instance.  To automate the deletion of failed events I wrote a script which loops through the failed events and removes 100 events with each looping iteration.  This mitigates the risk of crashing the JVM and also allows you to run the script and multi-task while the script is running.  The script is pasted below for your use.



######################################################################################
# Description: Script used to remove failed events
# Author: Mahesh Dondeti  mdondetimss@gmail.com
# Date: 2015-11-24
# Version Info: 1.0
######################################################################################


######################################################################################
#
#   Important Usage information:
#
# To run the script- run the following command"
#  [WAS_PROFILE_HOME]/bin/wsadmin.sh -lang jython -f FailedEventsDelete.py
#
#  (ensure you include the fully qualified path of the FailedEventsDelete.py script)
#
#
######################################################################################
# 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 "Failed event number before discarding: ", fecount

delnum = 100
fecount = int(fecount)

while (fecount > 0):
    if fecount < 100:
        delnum = fecount
        fecount = 0
    else:
        delnum = 100
        fecount = fecount - 100
     
    # get 100 failed events
    msglist = AdminControl.invoke_jmx(obj,'getAllFailedEvents',[delnum],['int'])

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

# count the overall number of failed events
fecount2 = AdminControl.invoke(objstr,"getFailedEventCount")
print "Failed event number after discarding: ", fecount2
 ######################################################################################
Command Console:-


 
Note: Check SOAP port  number on  your server .


Resubmit:-

# 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 "Failed event number before resubmit: ", fecount
delnum = 100
fecount = int(fecount)
while (fecount > 0):
    if fecount < 100:
        delnum = fecount
        fecount = 0
    else:
        delnum = 100
        fecount = fecount - 100 
    # get 100 failed events
    msglist = AdminControl.invoke_jmx(obj,'getAllFailedEvents',[delnum],['int'])
    # discard 100 events in single batch run
    print "Resubmiting ", delnum, " failed events"
    AdminControl.invoke_jmx(obj,'resubmitFailedEvents', [msglist],['java.util.List'])
# count the overall number of failed events
fecount2 = AdminControl.invoke(objstr,"getFailedEventCount")
print "Failed event number after Resubmiting: ", fecount2

I hope this post helps you. So far this is my best effort to explain. Please correct me if I do anything wrong.


Please share your valuable suggestions and feedback to my mail id"mdondetisbit@gmail.com" to improve myself.

Please post any issues/query’s related to BPM,WODM and DATAPOWER  to "mdondetisbit@gmail.com  

No comments:

Post a Comment