Java Reference
In-Depth Information
<beans:property name="targetMethod" value="validateInventory"/>
<step id="creditVerificationStep">
<chunk reader="orderReader" processor="creditVerificationProcessor"
writer="orderWriter" commit-interval="10"/>
<step id="inventoryVerificationStep">
<chunk reader="orderItemReader" processor="inventoryVerificationProcessor"
writer="orderWriter" commit-interval="10"/>
<job id="parallelJob">
<step id="step1" parent="preloadDataStep" next="step2"/>
<step id="step2" parent="batchOrderProcessingStep" next="parallelProcessing"/>
<split id="parallelProcessing" task-executor="taskExecutor">
<step id="step3" parent="creditVerificationStep"/>
<step id="step4" parent="inventoryVerificationStep"/>
Listing 11-16 shows the configuration of the required ItemReaders and ItemWriters as you would
expect as well as creditService and inventoryService . You use ItemProcessorAdapter to turn your
services into ItemProcessors and finally wire up each of the steps. It's in the job itself that things get
interesting for this example.
Within parallelJob , you begin with step 1, which points to step 2 (via the next attribute). However,
step 2 doesn't point to a step in the next attribute. Instead, it points to the split tag. Within the split
tag, you define two flows: one for the credit-card verification (using creditVerificationStep ) and one
for inventory verification (using inventoryVerificationStep ). These two flows are executed at the same
time. The parallelProcessing “step” is considered complete when both steps have completed.
That's it for the parallel processing aspect of the job. The final step, generation of the pick lists is
executed once the split pseudostep is complete. In the next section you will look at the required code for
the step and how that step is configured.
Building the Picklists
The final piece of the puzzle for this job is to write out picklists for the warehouse to pull the items. In
this case, you generate one picklist for each order that passed the credit-verification step
( creditValidated = true ) and for which all the OrderItem s in the order passed the inventory check
( inventoryValidated = true ). For this you have a HibernateCursorItemReader that reads only the
Search WWH ::

Custom Search