Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Spring批处理的下一步中了解上一步的执行状态_Spring_Batch Processing - Fatal编程技术网

如何在Spring批处理的下一步中了解上一步的执行状态

如何在Spring批处理的下一步中了解上一步的执行状态,spring,batch-processing,Spring,Batch Processing,我有一个包含3个步骤的批处理作业。我想阅读我的步骤3中步骤2的状态(完成/失败),以做出业务决策 我不想在步骤2的批处理配置中使用next on=“COMPLETED”to=“Tasklet1”next on=“FAILED”to=“Tasklet2”;因为我需要写两个小任务 我只想使用一个Tasklet来实现这一点。有什么方法可以让我知道步骤3中步骤2的步骤执行状态吗?希望您现在已经得到了解决方案。如否, 我不知道为什么要检查失败状态,因为如果步骤失败,作业将终止。它将无法进入下一步 对于上一

我有一个包含3个步骤的批处理作业。我想阅读我的
步骤3
步骤2
状态(完成/失败)
,以做出业务决策

我不想在步骤2的批处理配置中使用
next on=“COMPLETED”to=“Tasklet1”next on=“FAILED”to=“Tasklet2”
;因为我需要写两个小任务


我只想使用一个Tasklet来实现这一点。有什么方法可以让我知道步骤3中步骤2的步骤执行状态吗?

希望您现在已经得到了解决方案。如否,

我不知道为什么要检查失败状态,因为如果步骤失败,作业将终止。它将无法进入下一步

对于上一步的状态,您仍然可以检查jobExecution

List<JobExecution> jobExecutions = jobExplorer.getJobExecutions(jobInstance);
for (JobExecution jobExecution : jobExecutions) {
   // Make sure the execution id is the current id
   // Then get the list of stepExecutions from jobExecution
   jobExecution.getStemExecutions();
   // From the list, check for the step you are looking for and then
   stepExecution.getExitStatus();
}
List jobExecutions=jobExplorer.getJobExecutions(jobInstance);
for(作业执行作业执行:作业执行){
//确保执行id是当前id
//然后从jobExecution获取步骤执行列表
jobExecution.getStemeExecutions();
//从列表中,检查要查找的步骤,然后
stepExecution.getExitStatus();
}
该代码不是完整的代码和可编译的,但是我会给你一个关于你正在寻找的想法