SchedulerX supports stateful jobs. With data time, you can process data from a time range different from the actual job execution time.
Procedure
For example, a job that runs at 00:30 daily might need to process data from the previous day. You can set a time offset to shift the data time back by one hour from the job execution time.
-
Integrate SchedulerX with your client and implement the data time logic. For details, see the Quick Start guide.
public class TestHelloJob extends JavaProcessor { @Override public ProcessResult process(JobContext context) throws Exception { System.out.println("hello schedulerx2.0"); System.out.println("dataTime=" + context.getDataTime().toString("yyyy-MM-dd HH:mm:ss")); return new ProcessResult(true); } } -
Create a job in the console. For more information, see Create a scheduling job. In the Timing configuration, set the Time Offset to -3600 seconds. This creates a backward offset of 3,600 seconds (one hour). The job execution time remains unchanged, and when the job runs,
context.getDataTime()retrieves data from 23:30 of the previous day.
Result verification
-
After a job that contains a data time is created, go to the Execution List page, find the corresponding job, and in the Actions column, click Details.
-
On the Task instance details page, click Basic Information.
-
On the Basic Information tab, confirm that the job's Data Time is consistent with the settings.