Skip to Content
0

Need to clear all the pending events using redwood script

Nov 22, 2017 at 12:25 PM

67

avatar image
Former Member

Hi,

I need to clear all the pending events using redwood script on action(post session or pre session).

Thanks in Advance.

Thanks

Deepan..

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

avatar image
Former Member Nov 23, 2017 at 10:26 AM
0

Do you plan to clear all events of 1 specific Event Definition?

Or all events from all event definitions in the system ?

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

I need to clear one specific Event definition(all pending Events).

0
Dallas Beahm Nov 30, 2017 at 04:37 PM
0

This is what we use (To clear single events)... You could adapt this to get a list of all events if necessary, and clear all of them.

public void ClearEventComplete(String event)
{

    SchedulerSession jcsSession=ScriptSessionFactory.getSession();
    if(jcsSession ==null)
      throw new RuntimeException ("ERROR: jcs session is NULL");

    EventDefinition ev = jcsSession.getEventDefinitionByName(event);
    if(ev==null)
      throw new RuntimeException("ERROR: Unable to get Event Definition");

    try{
      ev.clearAllPending();
      ev.clear();
      jcsSession.persist();
    }
    catch(Exception e)
    {
       throw new RuntimeException(e.toString());     
    }

}
Share
10 |10000 characters needed characters left characters exceeded