Spring batch: Retry job if does not complete in particular time

穿精又带淫゛_ 提交于 2019-12-03 16:26:53

You can define transactional-attributes to a given step. (https://docs.spring.io/spring-batch/trunk/reference/htmlsingle/#transactionAttributes)

Transaction attributes can be used to control the isolation, propagation, and timeout settings.

<step id="step1">
  <tasklet>
      <chunk reader="itemReader" writer="itemWriter" commit-interval="2"/>
      <transaction-attributes isolation="DEFAULT"
                              propagation="REQUIRED"
                              timeout="30"/>
  </tasklet>
</step>

If you're using Java configuration check https://stackoverflow.com/a/23921558/1942642.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!