Tags:
create new tag
, view all tags
-- PedroRio - 22 Feb 2011

XEO Threads and Schedules

XEO Provides mechanisms to perform background work, such as batch jobs, maintenance, cleanup, etc. Those mechanisms are provided in the form of Threads and Schedules. Threads are usually used for XEO Core operations, while Schedules are usually application specific.

Ebo_Schedule

Schedules are instances of the Ebo_Schedule Object Model and allow you to execute custom code in a background operation at specific times. You can implement your custom code, and schedule it to run when you want.

Any given code you want to execute through a schedule must be created in a class that implements the netgest.bo.runtime.robot.boSchedule interface, which has a very simple declaration:

//Set a parameter for the 
public void setParameter(String parameter );
//Your custom code, you receive a context and the Ebo_Schedule instance corresponding
public boolean doWork(EboContext ctx, boObject objectSchedule ) throws boRuntimeException ;

When declaring an Ebo_Schedule you can declare the responsible user for the schedule execution (it it's not filled, the default user is SYSTEM). Ebo_Schedule instances are created in the XEO Administration Page.

A schedules will be executed if, and only if, the following conditions are met:

  • The Schedule is active.
  • The time of the day matches the schedule's configured execution time.
  • The Schedule's execution status is IDLE (if the Schedules has generated an error, or the schedule is running the execution is suspended)

_

Good Practice (Logging)

It's a good practice to create a dedicated log for each schedule you declare so that it's easier to debug when something goes wrong (having it mixed with the main log of the application could become a real mess)

Configuring Schedules

In order to have Ebo_Schedules execute you need to configure the boSchedule agent in boConfig.xml, as following:

<thread name="boSchedule Agent" ejb-name="ejb/boScheduleAgent" interval="10000"/>

_

Topic revision: r6 - 2011-04-04 - NicolauGrosskopf
 

No permission to view TWiki.WebTopBar

This site is powered by the TWiki collaboration platform Powered by Perl

No permission to view TWiki.WebBottomBar