Announcement Announcement Module
No announcement yet.
Spring Batch - Commit Chunk Scenario Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Batch - Commit Chunk Scenario

    Hi There,

    Wondering if the following scenario is possible in Spring Batch.

    The job will do the following

    1. Reader: Select statement (e.g. select * from tableA where status = 'READY') via JDBCcursoritemreader [say it will return 100 records)
    2. For each row returned we have composite writer configured
      • writer1: write row data to a file
      • writer2: update tableA row with status = 'PROCESSED' , Here we do not issue COMMIT for this update operation

    We want the mass commit in one go to happen after all 100 records are written to the file, Is it possible? If so how do we do it?

    If the mass commit is possible then is it also possible to ROLLBACK all updates?

    Reason for doing this to make sure the if the Spring Batch app crashes during the job then when we re-start the spring batch app again, we are able to get the same set of data with status='READY' to be processed again.