23장. 601번째 실패와 정확한 재시작
synthetic 주문 1,000건을 만들고 601번째에서 의도적으로 실패시킨다. businessDate와 fileChecksum을 identifying parameter로 고정한다. chunk가 100이면 600건까지 commit되고 다음 chunk가 rollback되는지 repository와 output에서 확인한다.
재시작 때 실패 switch만 해제하고 같은 identifying parameter를 사용한다. 실행 시각을 identifying parameter로 넣으면 새 JobInstance가 되어 처음부터 돌 수 있다. writer의 order_id unique, input checksum, rule version이 최종 방어다.
select job_execution_id,status,exit_code,create_time,end_time
from batch_job_execution order by job_execution_id;
select step_execution_id,status,read_count,write_count,
commit_count,rollback_count,skip_count
from batch_step_execution order by step_execution_id;
재시작 뒤 output 1,000, duplicate 0, gross=fee+net 불일치 0을 확인한다. rollback 때문에 일부 재읽기가 생겨도 업무 중복이 없어야 한다.