All Products
Search
Document Center

Microservices Engine:Set a data timestamp

Last Updated:Mar 11, 2026

Scheduled jobs often need to process data that was finalized before the job runs. For example, a daily job triggered at 00:30 might need to process data from 23:30 the previous day, but the trigger time alone does not reflect the actual data availability window.

SchedulerX provides a time offset parameter that shifts the data timestamp returned by context.getDataTime(). This lets the job target the correct data window regardless of when the job actually triggers.

How it works

When a job runs, SchedulerX calculates the data timestamp by applying the configured time offset to the trigger time:

Data timestamp = Trigger time + Time offset

Inside the job, context.getDataTime() returns this adjusted timestamp instead of the trigger time. Your job logic uses this timestamp to query or filter data from the correct time window.

The following example shows how the offset value affects the data timestamp:

ScheduleTrigger timeTime offsetData timestamp (getDataTime())
Daily at 00:3000:30 today-3600 (1 hour)23:30 previous day
The time offset value is in seconds. Negative values shift the data timestamp into the past.

Prerequisites

Before you begin, ensure that you have:

  • A SchedulerX agent connected to your application (see the Quick start topic)

Configure a time offset for a job

To configure a time offset, implement a job class that reads the adjusted data timestamp, then create the job in the SchedulerX console with the offset value.

Step 1: Retrieve the data timestamp in your job class

Extend JavaProcessor and call context.getDataTime() to retrieve the offset data timestamp.

public class TestHelloJob extends JavaProcessor {

    @Override
    public ProcessResult process(JobContext context) throws Exception {
        System.out.println("hello schedulerx2.0");

        // getDataTime() returns the trigger time adjusted by the time offset.
        // Use this timestamp to query data from the correct time window.
        System.out.println("dataTime=" + context.getDataTime().toString("yyyy-MM-dd HH:mm:ss"));

        return new ProcessResult(true);
    }

}
ElementDescription
JavaProcessorBase class for SchedulerX jobs
context.getDataTime()Returns the data timestamp, which equals the trigger time plus the configured time offset
ProcessResult(true)Signals that the job completed successfully

Step 2: Create the job and set the time offset

  1. Create a job in the SchedulerX console. For details, see Create a job.

  2. On the Timing configuration wizard page, set the Time offset parameter.

    ParameterValueDescription
    Time offset-3600Shifts the data timestamp 1 hour into the past. Unit: seconds.

With this configuration, the job triggers at 00:30 but context.getDataTime() returns 23:30 on the previous day.

Verify the result

  1. After the job runs, go to the Instances page.

  2. Find the job instance and click Details in the Operation column.

  3. On the Job Instance Details page, click Basic Information.

  4. Confirm that the Data Time field shows the expected offset timestamp (for example, 23:30 on the previous day rather than 00:30).

What's next