Search code examples
jsr352java-batch

JSR 352. Restarting partitions : How to checkpoint the commits?


I have a partitioned job that reads from and writes to a DB. I have a chunking size of 100. If a partition fails and i want the restart to happen from the last commit, do i have to explicitly specify the checkpoint? (in Serializable checkpointInfo()?)

If so how/where?


Solution

  • Answer

    You need to implement the pair of methods: checkpointInfo() and open() for your ItemReader (and you can for your ItemWriter as well).

    Example

    You can see an example in this answer.

    More info

    Note that for a partitioned step, each partition has its own checkpoint. In this way the programming model is very similar from the reader/processor/writer perspective across partitioned and non-partitioned steps, and so they can be written independently of whether or not they are running in a partition (for the most part).