3

我是春季批次的新手,对暂停/恢复有一些疑问。在阅读了 Spring Batch 文档后,似乎没有任何内置的暂停或恢复功能。但是,我从主站点找到了这个用例:

http://docs.spring.io/spring-batch/2.0.x/cases/pause.html

没有提供示例代码,或者我可以在任何地方找到这些示例吗?

在 Spring 批处理中,我知道内置了一个停止和重新启动功能。我可以将其用作暂停和恢复的一种形式吗?还是有另一种更好的方法?

4

2 回答 2

4

停止/重启本质上是暂停和恢复。它允许您以编程方式停止正在运行的作业并从中断处继续。

于 2013-09-23T21:56:30.653 回答
1

为此使用作业运算符,它是提供停止、重新启动、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();

}

这是一个例子

JOB_OPERATOR

于 2019-04-09T11:55:17.070 回答