Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Scheduling, unscheduling and rescheduling custom jobs

Scheduling custom jobs

...

The scheduling method of the IScheduler has four parameters:

  • the class of the job
  • the paramteres of the job
    • can be created by calling the IScheduler.createJobParameters().
  • the schedule of the job
    • can be created by calling IScheduler.getScheduleBuilder().onDate(Date date) or IScheduler.getScheduleBuilder().now() methods
  • the ID of the job
    • can be created by calling the IScheduler.createJobId(String jobId)
UI Expand
titleJava

Fpr scheduling custom jobs the Custom jobs can be scheduled using the SpringQuartzScheduler from theclass in the Quartz Scheduler Component.

Code Block
@Component
publicIJobParameters classparameters MyJob implements IJob {

 @Override
 public void execute(IExecutionContext context) {
	IJobParamters paramters = context.getParameters= scheduler.createJobParameters();
ISchedule schedule = scheduler.getScheduleBuilder().now();
	ISchedulerIJobId schedulerjobId = contextscheduler.getSchedulercreateJobId();
scheduler.schedule(MyJob.class, parameters,    
 }
}schedule, jobId);
UI Expand
title.NET

Custom jobs can be scheduled using the QuartzScheduler class in the Quartz Scheduler Component.

Code Block
BQ.IJobParameters parameters = scheduler.createJobParameters();
BQ.ISchedule schedule = scheduler.getScheduleBuilder().now();
BQ.IJobId jobId = scheduler.createJobId();
scheduler.schedule(typeof(MyJob), parameters, schedule, jobId);

//TODO update where the .NET job should be be available

Code Block
public class TestJob : BQ.IJob
{
    public void execute(BQ.IExecutionContext context)
    {
        BQ.IJobParamters parameters = context.getParameters();
        BQ.IScheduler scheduler = context.getScheduler();     
    }
}

Unscheduling custom jobs

Rescheduling custom jobs

...