Java Reference
In-Depth Information
<beans:bean id="customer" class="com.apress.springbatch.chapter9.Customer"
scope="prototype"/>
<beans:bean id="outputFile"
class="org.springframework.core.io.FileSystemResource" scope="step">
<beans:constructor-arg value="#{jobParameters[outputFile]}"/>
</beans:bean>
<beans:bean id="xmlOutputWriter"
class="org.springframework.batch.item.xml.StaxEventItemWriter">
<beans:property name="resource" ref="outputFile" />
<beans:property name="marshaller" ref="customerMarshaller" />
<beans:property name="rootTagName" value="customers" />
</beans:bean>
<beans:bean id="customerMarshaller"
class="org.springframework.oxm.xstream.XStreamMarshaller">
<beans:property name="aliases">
<util:map>
<beans:entry key="customer"
value="com.apress.springbatch.chapter9.Customer" />
</util:map>
</beans:property>
</beans:bean>
JmsReader and JmsWriter are configured the same way. Both of them are basic Spring beans with a
reference to the JmsTemplate configured in Listing 9-48. In Listing 9-50, you see the configuration of
JmsItemReader , JmsItemWriter , and the job to put all the readers/writers to work.
Listing 9-50. JmsItemReader and JmsItemWriter and the Job that Uses Them
...
<beans:bean id="jmsReader"
class="org.springframework.batch.item.jms.JmsItemReader">
<beans:property name="jmsTemplate" ref="jmsTemplate"/>
</beans:bean>
<beans:bean id="jmsWriter"
class="org.springframework.batch.item.jms.JmsItemWriter">
<beans:property name="jmsTemplate" ref="jmsTemplate"/>
</beans:bean>
<step id="formatFileInputStep">
<tasklet>
<chunk reader="customerFileReader" writer="jmsWriter"
commit-interval="10"/>
</tasklet>
</step>
<step id="formatFileOutputStep">
<tasklet>
 
Search WWH ::




Custom Search