Spring/Batch

Spring batch no.4

선우아범 2016. 8. 24. 13:58

4. job 설정 파일 생성. - job.xml


<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:batch="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util"

xmlns:hdp="http://www.springframework.org/schema/hadoop"

xsi:schemaLocation="

           http://www.springframework.org/schema/beans

           http://www.springframework.org/schema/beans/spring-beans.xsd

           http://www.springframework.org/schema/batch

           http://www.springframework.org/schema/batch/spring-batch.xsd

           http://www.springframework.org/schema/util 

           http://www.springframework.org/schema/util/spring-util.xsd

           http://www.springframework.org/schema/hadoop 

           http://www.springframework.org/schema/hadoop/spring-hadoop.xsd">


<!-- ################### Job ################### -->

<batch:job id="SearchJob">

<batch:step id="Step1">

<batch:tasklet transaction-manager="TransactionManager">

<batch:chunk reader="ItemReader" writer="ItemWriter" commit-interval="1000" />

</batch:tasklet>

</batch:step>

</batch:job>



<!-- ################### ItemReader ################### -->

<bean id="ItemReader" class="com.batch.item.SerchItemReader" scope="step">

</bean>


<!-- ################### ItemWriter ################### -->


<bean id="ItemWriter"

class="com.batch.item.SearchItemWriter" scope="step">

</bean>


</beans>



- tasklet 은 Transaction manager가 있어야 실행 된다.