Spring-Batchのテストでハマった
ハマった内容
- あるバッチにパラメーターを与えて実行する
- 1回目は成功するのだが、2回目以降は実行できない
ハマりの原因
- Spring-Batchにはジョブの実行結果を保存しておく機能がある
- ジョブ成功後に前回と同じパラメーターを与えて実行することはできない
Going by the concept of Job Instances and Job Executions in Spring Batch,
you can't start a COMPLETED job instance again
though you can launch same instance of job again &
again till its not COMPLETE ( and few more job statuses ).
Job instance uniqueness is achieved by jobId & job parameters
- 別のエラーメッセージが表示されるためにこの話までたどり着くのに時間がかかった
-
なんだこのクソゴミ機能は…素晴らしい機能ですね