Java Reference
In-Depth Information
To put this class to use, you need to begin building your job. Because the first step consists only of
generating Order s using OrderGenerator and writing them to a JMS queue, you can wire all that up and
test it without needing to go any further. Listing 11-8 shows the configuration of the job as a single-step
job that generates data and puts it on the queue for future steps to pick up.
Listing 11-8. Parallel Job Configured in parallelJob.xml with the First Step Configured
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns=""
<beans:import resource="../launch-context.xml"/>
<beans:bean id="jmsWriter" class="org.springframework.batch.item.jms.JmsItemWriter">
<beans:property name="jmsTemplate" ref="jmsTemplate"/>
<beans:bean id="dataGenerator"
<step id="preloadDataStep">
<chunk reader="dataGenerator" writer="jmsWriter" commit-interval="10"/>
<job id="parallelJob">
<step id="step1" parent="preloadDataStep"/>
Although the job itself is now configured, you need to make a couple of small tweaks to launch-
context.xml and your POM file for this job. Specifically, you need to configure JMS support and
Hibernate support (you use Hibernate for this job to simplify storing the object hierarchy) in launch-
context.xml and add the appropriate dependencies to your POM file. 2
Let's update the POM file first. Listing 11-9 shows the additional dependencies for ActiveMQ and
Spring's JMS support as well as the Hibernate dependencies and Spring's ORM supporting modules.
Listing 11-9. Updating the POM File to Support JMS and Hibernate
2 See Chapters 7 and 9 to learn more about using Hibernate and JMS in your jobs.
Search WWH ::

Custom Search