【问题标题】:Spring batch : Exception on writer and rollback is done but no retry executed春季批处理:编写器异常并完成回滚,但未执行重试
【发布时间】:2019-09-12 17:41:47
【问题描述】:

在编写器阶段发生异常时遇到问题。

由于数据库完整性问题导致一个项目回滚,并且不执行重试,因此处理器永远不会重播。

当一个项目导致回滚时,它会被跳过。并且其他项目正在重试,interval-commit to one。

但是,在我的例子中,没有对间隔提交为 one 的其他项目进行重试

你知道什么原因没有执行重试吗?

提前致谢。

【问题讨论】:

  • 您是否已将异常配置为可使用org.springframework.batch.core.step.builder.FaultTolerantStepBuilder#retry 重新绑定?请分享您的代码并希望能够为您提供帮助。

标签: spring spring-batch rollback skip writer


【解决方案1】:

我希望您添加了重试限制,并且重试异常类需要列在可重试列表中,请查看下面的示例语法以获取相同的内容

 <job id="flowJob">
 <step id="retryStep">
 <tasklet>
 <chunk reader="itemReader" writer="itemWriter"   processor="itemProcessor" commit-interval="1"  retry-limit="3">
 <retryable-exception-classes>
 <include   class="org.springframework.remoting.RemoteAccessException"/>
 </retryable-exception-classes>
 </chunk>
 </tasklet>
 </step>
 </job> 

【讨论】:

    猜你喜欢
    • 2018-02-08
    • 2020-09-07
    • 1970-01-01
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    • 2019-03-24
    • 2019-04-05
    • 2014-12-13
    相关资源
    最近更新 更多