Spring Batch:重试后跳过

时间:2016-12-26 12:41:59

标签: java spring spring-batch

假设我有一个像这样配置的简单tasklet:

<batch:tasklet>
  <batch:chunk reader="myItemReader" writer="myItemWriter" commit-interval="20" retry-limit="15" skip-limit="10">
    <batch:retryable-exception-classes>
      <batch:include class="de.codecentric.MyRetryableException" />
    </batch:retryable-exception-classes>
    <batch:skippable-exception-classes>
      <batch:include class="de.codecentric.MySkippableException" />
    </batch:skippable-exception-classes>
  </batch:chunk>
</batch:tasklet>

当抛出MyRetryableException时,我重试15次,但最后我得到org.springframework.retry.RetryException: Non-skippable exception in recoverer while processing; nested exception is然后作业终止。

如果15次重试没有帮助而不是完全失败,我想跳过该项。我应该只将RetryException添加到skippable-exception-classes列表中吗?

0 个答案:

没有答案