Spring batch pause/resume vs stop/restart

三世轮回 提交于 2019-12-08 21:05:39

Stop/restart is essentially pause and resume. It allows you to programmatically stop a running job and pick up where it left off.

use job operator for this, it is the basic interface which provides functionalities such as stop , restart , getStatus

public interface JobOperator {

List<Long> getExecutions(long instanceId) throws NoSuchJobInstanceException;

List<Long> getJobInstances(String jobName, int start, int count)
      throws NoSuchJobException;

Set<Long> getRunningExecutions(String jobName) throws NoSuchJobException;

String getParameters(long executionId) throws NoSuchJobExecutionException;

Long start(String jobName, String parameters)
      throws NoSuchJobException, JobInstanceAlreadyExistsException;

Long restart(long executionId)
      throws JobInstanceAlreadyCompleteException, NoSuchJobExecutionException,
              NoSuchJobException, JobRestartException;

Long startNextInstance(String jobName)
      throws NoSuchJobException, JobParametersNotFoundException, JobRestartException,
             JobExecutionAlreadyRunningException, JobInstanceAlreadyCompleteException;

boolean stop(long executionId)
      throws NoSuchJobExecutionException, JobExecutionNotRunningException;

String getSummary(long executionId) throws NoSuchJobExecutionException;

Map<Long, String> getStepExecutionSummaries(long executionId)
      throws NoSuchJobExecutionException;

Set<String> getJobNames();

}

Here is an example for that

JOB_OPERATOR

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!