I am working on a Spring batch application where I have used RetryTemplate
with SimpleRetryPolicy
.
In this application, ItemProcessor
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.