2013년 8월 27일 화요일

Spring Batch | Tasklet 옵션

Copied from : http://stackoverflow.com/questions/11119036/spring-batch-how-to-limit-the-no-of-executions-of-a-chunk

<batch:step id="mig-chain-data">
<batch:tasklet allow-start-if-complete="false" start-limit="1">
<batch:chunk commit-interval="1" reader="reader" writer="writer"></batch:chunk>
</batch:tasklet>
</batch:step>


 start-limit controls the number of times a Step may be started, not the chunk configured for this step.

From : http://www.codeproject.com/Articles/445856/Getting-Started-With-Spring-Batch-Part-Two

commit-interval 은 한번에 수행할 청크의 갯수를 지정 (processes 'N'  chunk at a time as indicated by the commit-interval)

Copied from : http://springsource.tistory.com/93
Tasklet
Tasklet 은 Step 내부의 트랜잭션 또는 반복될 수 있는 처리작업을 의미한다. 개발자들은 Tasklet 인터페이스를 직접 구현해서 사용하거나 스프링 배치가 제공하는 구현체를 사용할 수도 있다. 압축파일을 해제한다거나 특정 디렉토리를 정리하는 등의 특정 작업에는 직접 구현한 Tasklet 이 유용하다. 스프링 배치는 시스템 명령을 호출한다거나 chunk 기반(chunk-oriented) 처리를 수행할 수 있도록 좀더 일반화된 Tasklet 구현체를 제공한다. 
tasklet 엘리먼트가 제공하는 어트리뷰트는 다음과 같다.
ref : Tasklet 인터페이스를 구현한 스프링 빈의 id 를 의미한다. 커스텀 tasklet 을 사용하려면 이 어트리뷰트를 설정해 줘야 한다.
transaction-manager : Tasklet 에서 트랜젝션처리 시에 사용할 스프링 트랜젝션 매니저를 설정한다. tasklet 에서는 기본적으로 트랜잭션 처리가 가능하다. 디폴트 값은 transactionManager 이다.
allow-start-if-complete : Tasklet 의 실행이 성공했을 경우라도 스프링 배치가 이 Tasklet 을 재실행 가능한지 여부를 설정한다.

Reference : http://www.pfl-cepia.inra.fr/uploads/gdp_docs/spring-batch-2.0.pdf

댓글 없음:

댓글 쓰기