Java Reference
In-Depth Information
Listing 6-40. Configuring a Step to Be Reexecuted if Complete
<step id="importTransactionFileStep">
<tasklet allow-start-if-complete="true">
<chunk reader="transactionFileReader" writer="transactionWriter"
<stream ref="fileItemReader"/>
<listener ref="transactionFileReader"/>
In this case, when the step is executed for the second time within a job that failed or was stopped on
the previous execution, the step starts over. Because it completed the previous time, there is no middle
ground at which to restart, which is why it begins again at the beginning.
Note If the job has the ExitStatus of COMPLETE , the JobInstance can't be rerun regardless of whether you
configure all the steps to allow-start-if-complete="true" .
When you're configuring batch processes, Spring Batch offers many different options for stopping
and restarting jobs. Some scenarios can have the full job reexecuted. Others can be tried again, but only
a given number of times. And some can't be restarted at all. However, it's you, the developer, who must
design your batch jobs in a way that is safe for your scenario.
Starting or stopping a program isn't a topic that typically gets much press. But as you've seen,
controlling the execution of a Spring Batch process provides many options. And when you think about
the variety of scenarios that must be supported by batch processes, those options make sense.
The next section of this topic covers the meat of the framework: ItemReaders, ItemProcessors, and
Search WWH ::

Custom Search