사용자 도구

사이트 도구


springframework:batch

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
springframework:batch [2019/06/19 10:05]
kwon37xi
springframework:batch [2019/12/03 14:10]
kwon37xi
줄 62: 줄 62:
   * ''dataSource'' 자체를 null로 지정하면 ''MapJobRepository''로 DB없이 작동하게 만들어진다.   * ''dataSource'' 자체를 null로 지정하면 ''MapJobRepository''로 DB없이 작동하게 만들어진다.
   * SpringBoot 에서 ''DefaultBatchConfigurer'' 사용시 TransactionManager 오작동 문제가 발생한다. [[springframework:springboot:batch|SpringBoot와 SpringBatch]] 참고   * SpringBoot 에서 ''DefaultBatchConfigurer'' 사용시 TransactionManager 오작동 문제가 발생한다. [[springframework:springboot:batch|SpringBoot와 SpringBatch]] 참고
 +
 ===== JobRepository ===== ===== JobRepository =====
   * ''org.springframework.batch.core.repository.support.JobRepositoryFactoryBean''로 ''SimpleJobRepository'' 생성   * ''org.springframework.batch.core.repository.support.JobRepositoryFactoryBean''로 ''SimpleJobRepository'' 생성
줄 76: 줄 77:
  
 ===== Transaction 설정 ===== ===== Transaction 설정 =====
-===== 트랜잭션 매니저를 지정하지 않으면 =====+==== 트랜잭션 매니저를 지정하지 않으면 ====
 TransactionManager를 지정하지 않으면 다음과 같은 오류가 발생한다. TransactionManager를 지정하지 않으면 다음과 같은 오류가 발생한다.
  
줄 109: 줄 110:
 } }
 </code> </code>
 +
 +==== Chunk 사이즈가 크고 Transaction 이 긴데, 외부에 write 대상건을 알려주는 경우 DB Lock 발생할 수 있음 ====
 +  * batch 에 트랜잭션 매니저를 설정하고, writer 부분에서 데이터를 insert/update 할 때마다 그 사실을 MQ 등으로 외부에 알려주면,
 +  * 외부에서 그 데이터를 사용할 수 있게 하고자 했다면,
 +  * 절대로 Step 에 트랜잭션 매니저를 지정하지 말고, ''ResourcelessTransactionManager'' 를 사용하거나 CHUNK 를 작게 가져가야 한다.
 +  * 안그러면 CHUNK size 만큼의 처리가 모두 끝날때까지 DB lock 이 잡혀있어서 외부에서 이벤트를 받아서 처리하는 측에서 lock 획득에 실패해서 오류가 발생하게 된다.
  
 ===== JobInstanceAlreadyCompleteException: A job instance already exists and is complete for parameters 오류 발생 ===== ===== JobInstanceAlreadyCompleteException: A job instance already exists and is complete for parameters 오류 발생 =====
줄 170: 줄 177:
   * [[https://dzone.com/articles/spring-batch-with-quartz|Run a Spring Batch Job With Quartz]]   * [[https://dzone.com/articles/spring-batch-with-quartz|Run a Spring Batch Job With Quartz]]
   * [[https://www.youtube.com/watch?v=CYTj5YT7CZU&feature=youtu.be|Spring Batch (Michael Minella) - YouTube]]   * [[https://www.youtube.com/watch?v=CYTj5YT7CZU&feature=youtu.be|Spring Batch (Michael Minella) - YouTube]]
 +  * [[https://www.baeldung.com/spring-batch-skip-logic|Configuring Skip Logic in Spring Batch | Baeldung]]
springframework/batch.txt · 마지막으로 수정됨: 2023/12/08 13:43 저자 kwon37xi