Swanand
Swanand

Reputation: 117

commit interval having value as 1

My question relates to SpringBatch.

I would like to know what happens if we have the value of commit-interval as 1 in reader-writer step. I want to read and write the records individually ,so that if any record fails ,the rest of the records should still be written to the database.

Upvotes: 0

Views: 3512

Answers (1)

Haim Raman
Haim Raman

Reputation: 12023

In a classic read, process, write you with chuck limit of 10 for example you will have

  • 10 read of individual item
  • 10 process of individual item
  • 1 batch writing of 10 items.

So the math for chunk limit=1 is easy.

When you use commit interval =1 you are missing the benefits of batch writing which can be verify effective from performance perspective in database writer.

In case one of your records fails you can use the combination of skip-limit and maybe retry-limit in the chuck tag a with tags skippable-exception-classes and retryable-exception-classes to implement your scenario and still have the benefits of batch writing.

See the users guide for details.

Upvotes: 2

Related Questions