Announcement Announcement Module
No announcement yet.
commit interval Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • commit interval


    I understand spring batch 2 allows chunk read and only call writer once at end of the chunk.

    If I set commit interval of my tasklet to 5, that means spring batch will divide the input dataload into 5 groups, and call the reader 5 times and only call writer once at the end of step?

    The reason why I am asking this question is that I want to create a zip file to include all the input read in itemwriter. I don't want to create multiple zip files.

    Please help. thanks!

  • #2
    Each call to reader gives 1 item.

    Each call to processor takes 1 item and returns 1 item.

    Each call to writer takes 1 "batch" of items, depending on your batch size (1, 1000, whatever).

    If you want your writer to do the entire file at once, then you just need an item writer that keeps streaming the stuff to your zip file on disk until you are done.


    • #3
      Write entire chunk once

      Hi, we have a similar requirement where we read a bunch of records, process them one by one, but would like to write all of them at once. We are using Spring Batch 2.1.7 and commit-interval seems to be a mandatory parameter.

      Could you please let us know how this could be achieved in Spring Batch?

      Ramesh Javvaji