我有弹簧批处理,我想配置重试逻辑,我得到了以下配置:
<step id="roundUpMonthlyJobFetchUsers">
<tasklet>
<chunk reader="roundUpMonthlyItemReader" processor="roundUpMonthlyItemProcessor"
writer="roundUpMonthlyItemWriter" commit-interval="1" retry-limit="3" >
<retryable-exception-classes>
<include class="java.io.IOException" />
</retryable-exception-classes>
</chunk>
</tasklet>
<end on="COMPLETED"/>
<fail on="FAILED"/>
</step>
如何确认它实际上在遇到IOException时尝试至少执行3次操作
答案 0 :(得分:0)
更改此课程roundUpMonthlyItemReader
要在条目上记录某些内容,然后每次都抛出IOException,然后检查日志:)
log.info("Reading Monthly round up");
throw new IOException("Dummy IOException");
如果您希望在单元测试中执行此操作,则应该可以使用Mockito