Monday, August 2, 2010

OIM Howto: Create scheduled tasks

Scheduled tasks in OIM are used to run all kinds of reoccuring processes. They can also be used as convenient places to store little processes that needs to be run on demand.

To create a scheduled tasks you need to do the following things:
1. Create a java class that extends the SchedulerBaseTask (see example below)
2. Write your business logic
3. Compile and jar
4. Place the jar in the ScheduleTask directory in your OIM install
5. Create a new scheduled task using the OIM developer console
6. Link in the new class into your new scheduled task.
7. Done!

Example code for a scheduled task:

import com.thortech.xl.scheduler.tasks.SchedulerBaseTask;

public class ScheduledtaskExample extends SchedulerBaseTask {

   public void init()
   {
      //this method is run before execute by the scheduler 
   }

   public void execute() {
      //is executed by the scheduler
      runMyBusinessLogic();
   }

   private void runMyBusinessLogic(){
   //place your business logic here
   }
   
   public boolean stop() {
   //place logic that should run on a stop signal here
   }
}

2 comments: