我有一个春季批处理工作,我们正在执行以下任务。
<job>
<tasklet1>send msg to external sys1 </task1>
<!--After sending message to sys1 stop the job -->
<!--listener to read response from sys1 and restart job from tasklet2 using jobexecutiondecider -->
<tasklet2>Process response from sys1</tasklet>
<tasklet3>send msg to external sys2</task1>
<!--After sending message to sys2 stop the job -->
<!--listener to read response from sys2 and restart job from tasklet4 using jobexecutiondecider -->
<tasklet4>Process response from sys2</tasklet>
</job>
Spring批处理表将为同一个作业实例ID执行三个作业,因为我们多次重新启动相同的作业实例ID,如下所示。
现在我遇到一个问题,即在Jobexe1.2的上下文中,Jobexe1.1的作业执行上下文中设置的值不存在。
问题: 1如果我在Jobexe1.1的jobexecution上下文中存储了一些内容, 是否可用于Jobexe1.2的作业执行上下文?
问题2:如果不是上述情况,那么我们如何在作业实例ID 1的不同作业执行之间共享数据?
问题3:为什么spring批处理没有像jobinstance执行上下文这样的东西,以便我们可以轻松地在一个作业实例id的不同作业执行之间共享数据?
注意 - 我知道stepexecutioncontext用于在step和jobexecutioncontext中共享数据,以便在作业执行的步骤之间共享数据。