繁体   English   中英

春季批处理:如果未写入任何项目,则停止批处理作业

[英]Spring batch: Stop the batch job if no items are written

我正在从事春季批处理工作。 流程如下

步骤1 :(在File1上读取,处理,写入)

步骤2:邮件输入

步骤3 :(在File2上读取,处理,写入)

步骤4:File2的邮件条目。

如果没有写任何项目,我想跳过邮寄步骤。

我遇到了像

<batch:decision id="decision" decider="com/Decider">
        <batch:next on="FAILED" to="step_3"/>
        <batch:next on="COMPLETED" to="step_2"/>
</batch:decision>

但是如何获取从上一步到该决策类的写计数?

StepExecution JobExecutionDecider#decide具有一个StepExecution参数,您可以在其中找到在上一步执行过程中写入了多少个项目( StepExecution#getWriteCount

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM