SchedulerX allows you to process dynamic data. You can schedule a job to process the data that is updated at a point in time outside the time scale of the job.

Procedure

For example, a job is triggered at 00:30 every day. If you want to use the job to process data that was updated at 23:30 on the previous day, you must set the time offset of the job to 1 hour.

  1. Connect the agent to SchedulerX and process time series data. For more information about how to connect the agent to SchedulerX, see the Quick start topic.
    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);
        }
    
    }
  2. Create a job in the SchedulerX console. For more information, see Create a job. Set the Time offset parameter on the Timing configuration wizard page to -3600 (1 hour). Unit: seconds. The job is still triggered at 00:30. After the job is triggered, the job uses the context.getDataTime() method to retrieve the data that was updated at 23:30 on the previous day.

Verify the result

  1. After the job is created, go to the Instances page, find the corresponding job instance and click Details in the Operation column.
  2. On the Job Instance Details page, click Basic Information.
  3. On the Basic Information tab, check whether the value of Data Time is the same as the specified value.