Java Reference
In-Depth Information
That's all we wanted to do and we achieved it in a single batch step: reading, processing,
and writing. In the chunk-oriented approach, we will have three separate mechanisms for
this. Let's add our new step to externalSystem.xml from src/main/re-
sources/META-INF/batch-jobs :
<job id="externalSystem" xmlns="http://xmlns.jcp.org/xml/ns/
javaee"
version="1.0">
<properties>
<property name="logFile" value="log.txt" />
<property name="bitcoinFile" value="bitcoins.txt"
/> [1]
</properties>
<step id="processData" next="checkBitcoins" > [2]
<chunk item-count="2">
<reader ref="externalSystemReader" />
<processor ref="seatProcessor" />
<writer ref="seatWriter" />
</chunk>
</step>
<step id="checkBitcoins"> [3]
<batchlet ref="bitcoinTask" />
</step>
</job>
There are three new things to notice in the XML file. First, we added a new property,
which we referenced earlier in our batchlet [1] . Next, we defined that after our chunk
processing step, we would like to invoke another one, checkBitcoins [2] . Finally,
we created a new step in which we referenced our batchlet class.
You can once again start your job, and after it is completed, a bitcoins.txt file
should appear in WildFly's bin directory.
We've covered the foundation of the batching framework, which allows you to fulfill most
of the frequent requirements defined for enterprise applications. However, there is a lot
more inside the specification, such as splits, partitions, and workflow-related elements
(statuses and decisions) that you can explore if a more sophisticated mechanism is re-
quired by the business processes that you're implementing.
Search WWH ::




Custom Search