Fixed documentation to correctly use BatchStatus value instead of RepeatStatus value
This commit is contained in:
@@ -305,7 +305,7 @@ itemWriter.write(items);</programlisting>
|
||||
successful the first time. An example might be a validation step, or a
|
||||
<classname>Step</classname> that cleans up resources before
|
||||
processing. During normal processing of a restarted job, any step with
|
||||
a status of 'FINISHED', meaning it has already been completed
|
||||
a status of 'COMPLETED', meaning it has already been completed
|
||||
successfully, will be skipped. Setting allow-start-if-complete to
|
||||
"true" overrides this so that the step will always run:</para>
|
||||
|
||||
@@ -322,19 +322,19 @@ itemWriter.write(items);</programlisting>
|
||||
<programlisting><job id="footballJob" restartable="true">
|
||||
<step id="playerload" next="gameLoad">
|
||||
<tasklet>
|
||||
<chunk reader="playerFileItemReader" writer="playerWriter"
|
||||
<chunk reader="playerFileItemReader" writer="playerWriter"
|
||||
commit-interval="10" />
|
||||
</tasklet>
|
||||
</step>
|
||||
<step id="gameLoad" next="playerSummarization">
|
||||
<tasklet allow-start-if-complete="true">
|
||||
<chunk reader="gameFileItemReader" writer="gameWriter"
|
||||
<chunk reader="gameFileItemReader" writer="gameWriter"
|
||||
commit-interval="10"/>
|
||||
</tasklet>
|
||||
</step>
|
||||
<step id="playerSummarization">
|
||||
<tasklet start-limit="3">
|
||||
<chunk reader="playerSummarizationSource" writer="summaryWriter"
|
||||
<chunk reader="playerSummarizationSource" writer="summaryWriter"
|
||||
commit-interval="10"/>
|
||||
</tasklet>
|
||||
</step>
|
||||
@@ -453,7 +453,7 @@ itemWriter.write(items);</programlisting>
|
||||
records are logged as well, which will be covered later when discussing
|
||||
listeners.<programlisting><step id="step1">
|
||||
<tasklet>
|
||||
<chunk reader="flatFileItemReader" writer="itemWriter"
|
||||
<chunk reader="flatFileItemReader" writer="itemWriter"
|
||||
commit-interval="10" <emphasis role="bold">skip-limit="10"</emphasis>>
|
||||
<emphasis role="bold"><skippable-exception-classes>
|
||||
<include class="org.springframework.batch.item.file.FlatFileParseException"/>
|
||||
@@ -477,7 +477,7 @@ itemWriter.write(items);</programlisting>
|
||||
identify which exceptions should cause failure and skip everything
|
||||
else:<programlisting><step id="step1">
|
||||
<tasklet>
|
||||
<chunk reader="flatFileItemReader" writer="itemWriter"
|
||||
<chunk reader="flatFileItemReader" writer="itemWriter"
|
||||
commit-interval="10" <emphasis role="bold">skip-limit="10"</emphasis>>
|
||||
<emphasis role="bold"> <skippable-exception-classes>
|
||||
<include class="java.lang.Exception"/>
|
||||
@@ -519,7 +519,7 @@ itemWriter.write(items);</programlisting>
|
||||
|
||||
<programlisting><step id="step1">
|
||||
<tasklet>
|
||||
<chunk reader="itemReader" writer="itemWriter"
|
||||
<chunk reader="itemReader" writer="itemWriter"
|
||||
commit-interval="2" <emphasis role="bold">retry-limit="3"</emphasis>>
|
||||
<emphasis role="bold"><retryable-exception-classes>
|
||||
<include class="org.springframework.dao.DeadlockLoserDataAccessException"/>
|
||||
@@ -590,8 +590,8 @@ itemWriter.write(items);</programlisting>
|
||||
<programlisting><step id="step1">
|
||||
<tasklet>
|
||||
<chunk reader="itemReader" writer="itemWriter" commit-interval="2"/>
|
||||
<transaction-attributes isolation="DEFAULT"
|
||||
propagation="REQUIRED"
|
||||
<transaction-attributes isolation="DEFAULT"
|
||||
propagation="REQUIRED"
|
||||
timeout="30"/>
|
||||
</tasklet>
|
||||
</step></programlisting>
|
||||
@@ -629,7 +629,7 @@ itemWriter.write(items);</programlisting>
|
||||
</tasklet>
|
||||
</step>
|
||||
|
||||
<beans:bean id="compositeWriter"
|
||||
<beans:bean id="compositeWriter"
|
||||
class="org.springframework.batch.item.support.CompositeItemWriter">
|
||||
<beans:property name="delegates">
|
||||
<beans:list>
|
||||
@@ -791,11 +791,11 @@ itemWriter.write(items);</programlisting>
|
||||
be beneficial to log the skipped records, so that they can be deal
|
||||
with later. In the case of read errors, this can be done with an
|
||||
<classname>ItemReaderListener:</classname><programlisting>public interface ItemReadListener<T> extends StepListener {
|
||||
|
||||
|
||||
void beforeRead();
|
||||
|
||||
void afterRead(T item);
|
||||
|
||||
|
||||
void onReadError(Exception ex);
|
||||
|
||||
}</programlisting></para>
|
||||
@@ -1058,16 +1058,16 @@ itemWriter.write(items);</programlisting>
|
||||
|
||||
private Resource directory;
|
||||
|
||||
public RepeatStatus execute(StepContribution contribution,
|
||||
public RepeatStatus execute(StepContribution contribution,
|
||||
ChunkContext chunkContext) throws Exception {
|
||||
File dir = directory.getFile();
|
||||
Assert.state(dir.isDirectory());
|
||||
|
||||
|
||||
File[] files = dir.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
boolean deleted = files[i].delete();
|
||||
if (!deleted) {
|
||||
throw new UnexpectedJobExecutionException("Could not delete file " +
|
||||
throw new UnexpectedJobExecutionException("Could not delete file " +
|
||||
files[i].getPath());
|
||||
}
|
||||
}
|
||||
@@ -1095,10 +1095,10 @@ itemWriter.write(items);</programlisting>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<beans:bean id="fileDeletingTasklet"
|
||||
<beans:bean id="fileDeletingTasklet"
|
||||
class="org.springframework.batch.sample.tasklet.FileDeletingTasklet">
|
||||
<beans:property name="directoryResource">
|
||||
<beans:bean id="directory"
|
||||
<beans:bean id="directory"
|
||||
class="org.springframework.core.io.FileSystemResource">
|
||||
<beans:constructor-arg value="target/test-outputs/test-dir" />
|
||||
</beans:bean>
|
||||
@@ -1237,7 +1237,7 @@ itemWriter.write(items);</programlisting>
|
||||
<classname>Step</classname>, if the <classname>Step</classname>'s
|
||||
execution results in an <classname>ExitStatus</classname> that is not
|
||||
covered by an element, then the framework will throw an exception and
|
||||
the <classname>Job</classname> will fail. The framework will
|
||||
the <classname>Job</classname> will fail. The framework will
|
||||
automatically order transitions from most specific to
|
||||
least specific. This means that even if the elements were swapped for
|
||||
"stepA" in the example above, an <classname>ExitStatus</classname> of
|
||||
@@ -1312,7 +1312,7 @@ itemWriter.write(items);</programlisting>
|
||||
|
||||
public ExitStatus afterStep(StepExecution stepExecution) {
|
||||
String exitCode = stepExecution.getExitStatus().getExitCode();
|
||||
if (!exitCode.equals(ExitStatus.FAILED.getExitCode()) &&
|
||||
if (!exitCode.equals(ExitStatus.FAILED.getExitCode()) &&
|
||||
stepExecution.getSkipCount() > 0) {
|
||||
return new ExitStatus("COMPLETED WITH SKIPS");
|
||||
}
|
||||
@@ -1497,7 +1497,7 @@ itemWriter.write(items);</programlisting>
|
||||
|
||||
<para><programlisting><job id="job">
|
||||
<step id="step1" parent="s1" next="decision" />
|
||||
|
||||
|
||||
<decision id="decision" decider="decider">
|
||||
<next on="FAILED" to="step2" />
|
||||
<next on="COMPLETED" to="step3" />
|
||||
@@ -1592,7 +1592,7 @@ itemWriter.write(items);</programlisting>
|
||||
|
||||
<para><programlisting><job id="jobStepJob" restartable="true">
|
||||
<step id="jobStepJob.step1">
|
||||
<job ref="<emphasis role="bold">job</emphasis>" job-launcher="jobLauncher"
|
||||
<job ref="<emphasis role="bold">job</emphasis>" job-launcher="jobLauncher"
|
||||
job-parameters-extractor="jobParametersExtractor"/>
|
||||
</step>
|
||||
</job>
|
||||
@@ -1714,8 +1714,8 @@ itemWriter.write(items);</programlisting>
|
||||
scope must be added explicitly, either by using the
|
||||
<literal>batch</literal> namespace:</para>
|
||||
|
||||
<programlisting><beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:batch="http://www.springframework.org/schema/batch"
|
||||
<programlisting><beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:batch="http://www.springframework.org/schema/batch"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="...">
|
||||
<batch:job .../>
|
||||
|
||||
Reference in New Issue
Block a user