in src/main/java/org/apache/sling/jobs/it/services/FullySyncJob.java [52:73]
public void execute(@NotNull Job initialState, @NotNull JobUpdateListener listener, @NotNull JobCallback callback) {
LOGGER.info("Got request to start job {} ", initialState);
initialState.setState(Job.JobState.ACTIVE);
listener.update(initialState.newJobUpdateBuilder().command(JobUpdate.JobUpdateCommand.UPDATE_JOB).put("processing", "step1").build());
// DO some work here.
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
LOGGER.debug(e.getMessage(), e);
}
listener.update(initialState.newJobUpdateBuilder().command(JobUpdate.JobUpdateCommand.UPDATE_JOB).put("processing", "step2").build());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
LOGGER.debug(e.getMessage(),e);
}
initialState.setState(Job.JobState.SUCCEEDED);
listener.update(initialState.newJobUpdateBuilder().command(JobUpdate.JobUpdateCommand.UPDATE_JOB).put("processing", "step3").build());
callback.callback(initialState);
}