Spring batch 基于作业参数跳过步骤
我读了几遍spring批处理文档,并根据作业参数寻找跳过作业步骤的方法 比如说我有这份工作Spring batch 基于作业参数跳过步骤,spring-batch,Spring Batch,我读了几遍spring批处理文档,并根据作业参数寻找跳过作业步骤的方法 比如说我有这份工作 <batch:job id="job" restartable="true" xmlns="http://www.springframework.org/schema/batch"> <batch:step id="step1-partitioned-export-master"> <batch:partition ha
<batch:job id="job" restartable="true"
xmlns="http://www.springframework.org/schema/batch">
<batch:step id="step1-partitioned-export-master">
<batch:partition handler="partitionHandler"
partitioner="partitioner" />
<batch:next on="COMPLETED" to="step2-join" />
</batch:step>
<batch:step id="step2-join">
<batch:tasklet>
<batch:chunk reader="xmlMultiResourceReader" writer="joinXmlItemWriter"
commit-interval="1000">
</batch:chunk>
</batch:tasklet>
<batch:next on="COMPLETED" to="step3-zipFile" />
</batch:step>
<batch:step id="step3-zipFile">
<batch:tasklet ref="zipFileTasklet" />
<!-- <batch:next on="COMPLETED" to="step4-fileCleanUp" /> -->
</batch:step>
<!-- <batch:step id="step4-fileCleanUp">
<batch:tasklet ref="fileCleanUpTasklet" />
</batch:step> -->
</batch:job>
如果需要,我希望能够通过在作业参数中指定来跳过步骤4
我能找到的唯一有点相关的问题是
这似乎表明应创建两个不同的作业上下文,并在批处理步骤定义之外做出决策
我已经遵循了这个模式,因为我有一个csv导出以及示例中的xml。我将这两个作业拆分为单独的spring-context.xml文件,每个导出类型对应一个文件,尽管它们之间没有太多差异
在那一点上,我认为它可能更干净,因为我找不到替代品的例子
但是,必须创建4个单独的上下文文件,以便能够为每个导出案例包含步骤4或不包含步骤4,这似乎有点疯狂
我一定是遗漏了什么。你不能用决策者来做吗?(第5.3.4章程序流程决策) 编辑:链接到更新的url