Warning! This documentation is a work in progress. Expect things to be out of date and not actually work according to instructions.

Recurring Jobs

var Job = Java.type('io.stallion.jobs.Job'); var JobDefinition = Java.type('io.stallion.jobs.JobDefinition'); var Schedule = Java.type('io.stallion.jobs.Schedule'); var JobRunner = Java.extend(Job, { execute: function() { stallion.Log.info("Job is running!"); } }); var jobDefinition = new JobDefinition() .setName("js-job") .setSchedule(Schedule.hourly()) .setJobClass(JobRunner.class); stallion.registerJob(jobDefinition); import io.stallion.jobs.Job; public class ExampleJob implements Job { @Override public void execute() { Log.info("I am a job that is running!"); } } JobDefinition jobDefinition = new JobDefinition() .setJobClass(ExampleJob.class) .setAlertThresholdMinutes(3000) .setSchedule(new Schedule() .minutes(0) .hours(17) .daysOfWeek(DayOfWeek.TUESDAY) .everyMonth() .verify()); JobCoordinator.instance().registerJob(jobDefinition);

© 2024 Stallion Software LLC