0
votes

I am writing spring batch having dynamic size of chunk. I am using skip policy which skips item if any kind of exception occurs.

Now the when exception occurs in writer it does following,

when the item writer throws a skippable exception. Because the framework doesn’t know which item threw the exception, it reprocesses single item at a time and pass single item to writer (except error item)

What I want is if any kind of exception occurs in writer it will pass all items (except error one) as a list to writer again and NOT one by one. I am creating excel file in writer there I need all item in chunk at same time and not one by one.

Is there any way to achieve this in spring batch?

Thank you !!

1
Why does it matter if you write the items one by one or all at once? - Michael Minella
in writer I am writing heading data, doing some calculation to check if i should show this column or not,sorting records,dividing it sheet wise..and so on,,for this i need all data in chunk at once in writer. - Prashant Shilimkar
So you are writing the entire sheet at once? - Michael Minella
Yes..infact entire workbook having multiple sheets - Prashant Shilimkar

1 Answers

0
votes

The only way to accomplish this is basically working around Spring Batch and having your item be the full list, and your chunk size be 1. Then it would be up to you to handle skip/etc logic.