Skip to Content
avatar image
Former Member

Need to clear all the pending events using redwood script

Hi,

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

Thanks in Advance.

Thanks

Deepan..

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 23, 2017 at 10:26 AM

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

    Or all events from all event definitions in the system ?

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 30, 2017 at 04:37 PM

    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());     
        }
    
    }
    Add comment
    10|10000 characters needed characters exceeded