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

前端 未结 1 1062
陌清茗
陌清茗 2021-02-10 04:19

I am working on a Spring batch application where I have used RetryTemplate with SimpleRetryPolicy.

In this application, ItemProcessor

相关标签:
1条回答
  • 2021-02-10 05:01

    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.

    0 讨论(0)
提交回复
热议问题