Java Reference
In-Depth Information
know is that they supply input and output, respectively, for the step. The commit-interval defines how
many items make up a chunk (50 items, in this case).
Listing 4-34. A Basic Chunk Configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns=" http://www.springframework.org/schema/batch"
xmlns:beans=" http://www.springframework.org/schema/beans"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch-2.1.xsd">
<beans:import resource="../launch-context.xml" />
<beans:bean id="inputFile"
class="org.springframework.core.io.FileSystemResource" scope="step">
<beans:constructor-arg value="#{jobParameters[inputFile]}"/>
</beans:bean>
<beans:bean id="outputFile"
class="org.springframework.core.io.FileSystemResource" scope="step">
<beans:constructor-arg value="#{jobParameters[outputFile]}"/>
</beans:bean>
<beans:bean id="inputReader"
class="org.springframework.batch.item.file.FlatFileItemReader">
<beans:property name="resource" ref="inputFile"/>
<beans:property name="lineMapper">
<beans:bean
class="org.springframework.batch.item.file.mapping.PassThroughLineMapper"/>
</beans:property>
</beans:bean>
<beans:bean id="outputWriter"
class="org.springframework.batch.item.file.FlatFileItemWriter">
<beans:property name="resource" ref="outputFile"/>
<beans:property name="lineAggregator">
<beans:bean
class="org.springframework.batch.item.file.transform.PassThroughLineAggregator"/>
</beans:property>
</beans:bean>
<step id="copyStep">
<tasklet>
<chunk reader="inputReader" writer="outputWriter"
commit-interval="50"/>
</tasklet>
</step>
<job id="chunkConfigurationJob">
Search WWH ::




Custom Search