BATCH-1368: Update docs to remove <listener class="..."/> syntax
This commit is contained in:
@@ -56,7 +56,9 @@
|
||||
<programlisting><step id="simpleStep">
|
||||
...
|
||||
<listeners>
|
||||
<listener class="org.example...ItemFailureLoggerListener"/>
|
||||
<listener>
|
||||
<bean class="org.example...ItemFailureLoggerListener"/>
|
||||
</listener>
|
||||
</listeners>
|
||||
</step></programlisting>
|
||||
|
||||
|
||||
@@ -2,61 +2,42 @@
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<chapter id="configureJob">
|
||||
<title>Configuring and Running a Job</title>
|
||||
<title>Configuring and Running a Job</title>
|
||||
|
||||
<para>
|
||||
In
|
||||
<xref linkend="domain" />
|
||||
, the overall architecture design was
|
||||
discussed, using the following diagram as a guide:
|
||||
</para>
|
||||
<para>In <xref linkend="domain" /> , the overall architecture design was
|
||||
discussed, using the following diagram as a guide:</para>
|
||||
|
||||
<mediaobject>
|
||||
<imageobject role="html">
|
||||
<imagedata align="center" fileref="images/spring-batch-reference-model.png"
|
||||
format="PNG" scale="100" />
|
||||
</imageobject>
|
||||
<mediaobject>
|
||||
<imageobject role="html">
|
||||
<imagedata align="center"
|
||||
fileref="images/spring-batch-reference-model.png"
|
||||
format="PNG" scale="100" />
|
||||
</imageobject>
|
||||
|
||||
<imageobject role="fo">
|
||||
<imagedata align="center" fileref="images/spring-batch-reference-model.png"
|
||||
format="PNG" scale="55" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
<imageobject role="fo">
|
||||
<imagedata align="center"
|
||||
fileref="images/spring-batch-reference-model.png"
|
||||
format="PNG" scale="55" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
|
||||
<para>
|
||||
While the
|
||||
<classname>Job</classname>
|
||||
object may seem like a simple
|
||||
container for steps, there are many configuration options of which a
|
||||
developers must be aware . Furthermore, there are many considerations for
|
||||
how a
|
||||
<classname>Job</classname>
|
||||
will be run and how its meta-data will be
|
||||
stored during that run. This chapter will explain the various configuration
|
||||
options and runtime concerns of a
|
||||
<classname>Job</classname>
|
||||
.
|
||||
</para>
|
||||
<para>While the <classname>Job</classname> object may seem like a simple
|
||||
container for steps, there are many configuration options of which a
|
||||
developers must be aware . Furthermore, there are many considerations for
|
||||
how a <classname>Job</classname> will be run and how its meta-data will be
|
||||
stored during that run. This chapter will explain the various configuration
|
||||
options and runtime concerns of a <classname>Job</classname> .</para>
|
||||
|
||||
<section id="configuringAJob">
|
||||
<title>Configuring a Job</title>
|
||||
<section id="configuringAJob">
|
||||
<title>Configuring a Job</title>
|
||||
|
||||
<para>
|
||||
There are multiple implementations of the
|
||||
<link linkend="job">
|
||||
<classname>Job</classname>
|
||||
</link>
|
||||
interface, however, the
|
||||
namespace abstracts away the differences in configuration. It has only
|
||||
three required dependencies: a name,
|
||||
<classname>JobRepository</classname>
|
||||
,
|
||||
and a list of
|
||||
<classname>Step</classname>
|
||||
s.
|
||||
</para>
|
||||
<para>There are multiple implementations of the <link linkend="job">
|
||||
<classname>Job</classname> </link> interface, however, the namespace
|
||||
abstracts away the differences in configuration. It has only three
|
||||
required dependencies: a name, <classname>JobRepository</classname> , and
|
||||
a list of <classname>Step</classname> s.</para>
|
||||
|
||||
<programlisting><job id="footballJob">
|
||||
<programlisting><job id="footballJob">
|
||||
<step id="playerload" parent="s1" next="gameLoad"/>
|
||||
<step id="gameLoad" parent="s2" next="playerSummarization"/>
|
||||
<step id="playerSummarization" parent="s3"/>
|
||||
@@ -145,7 +126,7 @@ catch (JobRestartException e) {
|
||||
<step id="gameLoad" parent="s2" next="playerSummarization"/>
|
||||
<step id="playerSummarization" parent="s3"/>
|
||||
<emphasis role="bold"> <listeners>
|
||||
<listener class="org.springframework.batch.sample.SampleListener"/>
|
||||
<listener ref="sampleListener"/>
|
||||
</listeners>
|
||||
</emphasis></job></programlisting>
|
||||
|
||||
@@ -196,7 +177,7 @@ catch (JobRestartException e) {
|
||||
|
||||
<programlisting><job id="baseJob" abstract="true">
|
||||
<listeners>
|
||||
<listener class="com.ListenerOne"/>
|
||||
<listener ref="listenerOne"/>
|
||||
<listeners>
|
||||
</job>
|
||||
|
||||
@@ -204,7 +185,7 @@ catch (JobRestartException e) {
|
||||
<step id="step1" parent="standaloneStep"/>
|
||||
|
||||
<listeners merge="true">
|
||||
<listener class="com.ListenerTwo"/>
|
||||
<listener ref="listenerTwo"/>
|
||||
<listeners>
|
||||
</job></programlisting>
|
||||
|
||||
@@ -353,9 +334,10 @@ catch (JobRestartException e) {
|
||||
|
||||
<para>Note that the in-memory repository is volatile and so does not
|
||||
allow restart between JVM instances. It also cannot guarantee that two
|
||||
job instances with the same parameters are launched simultaneously, and
|
||||
is not suitable for use in a multi-threaded Job, or a locally partitioned Step. So
|
||||
use the database version of the repository wherever you need those features.</para>
|
||||
job instances with the same parameters are launched simultaneously, and
|
||||
is not suitable for use in a multi-threaded Job, or a locally
|
||||
partitioned Step. So use the database version of the repository wherever
|
||||
you need those features.</para>
|
||||
|
||||
<para>However it does require a transaction manager to be defined
|
||||
because there are rollback semantics within the repository, and because
|
||||
|
||||
@@ -233,12 +233,12 @@ itemWriter.write(items);</programlisting>
|
||||
|
||||
<para>In the following example, the <classname>Step</classname>
|
||||
"concreteStep3" will be created will two listeners:
|
||||
<classname>com.ListenerOne</classname> and
|
||||
<classname>com.ListenerTwo</classname>:</para>
|
||||
<classname>listenerOne</classname> and
|
||||
<classname>listenerTwo</classname>:</para>
|
||||
|
||||
<programlisting><step id="listenersParentStep" abstract="true">
|
||||
<listeners>
|
||||
<listener class="com.ListenerOne"/>
|
||||
<listener ref="listenerOne"/>
|
||||
<listeners>
|
||||
</step>
|
||||
|
||||
@@ -246,7 +246,7 @@ itemWriter.write(items);</programlisting>
|
||||
<tasklet>
|
||||
<chunk reader="itemReader" writer="itemWriter" commit-interval="5"/>
|
||||
<listeners merge="true">
|
||||
<listener class="com.ListenerTwo"/>
|
||||
<listener ref="listenerTwo"/>
|
||||
<listeners>
|
||||
</tasklet>
|
||||
</step></programlisting>
|
||||
@@ -696,16 +696,16 @@ itemWriter.write(items);</programlisting>
|
||||
</tasklet>
|
||||
</step></programlisting>
|
||||
|
||||
<para>An <classname>ItemReader</classname>, <classname>ItemWriter</classname>
|
||||
or <classname>ItemProcessor</classname> that itself implements
|
||||
one of the <classname>StepListener</classname> interfaces will
|
||||
be registered automatically with the <classname>Step</classname>
|
||||
if using the namespace <literal><step></literal> element,
|
||||
or one of the the <classname>*StepFactoryBean</classname>
|
||||
factories. This only applies to components directly injected
|
||||
into the <classname>Step</classname>: if the listener is nested
|
||||
inside another component, it needs to be explicitly registered
|
||||
(as described above).</para>
|
||||
<para>An <classname>ItemReader</classname>,
|
||||
<classname>ItemWriter</classname> or
|
||||
<classname>ItemProcessor</classname> that itself implements one of the
|
||||
<classname>StepListener</classname> interfaces will be registered
|
||||
automatically with the <classname>Step</classname> if using the
|
||||
namespace <literal><step></literal> element, or one of the the
|
||||
<classname>*StepFactoryBean</classname> factories. This only applies to
|
||||
components directly injected into the <classname>Step</classname>: if
|
||||
the listener is nested inside another component, it needs to be
|
||||
explicitly registered (as described above).</para>
|
||||
|
||||
<para>In addition to the <classname>StepListener</classname> interfaces,
|
||||
annotations are provided to address the same concerns.</para>
|
||||
|
||||
Reference in New Issue
Block a user