I have a simple Spring Batch job with couple of steps, the last step is to write report, so i haver ItemReader, ItemProcessor and ItemWriter. ItemWriter write by chunk depends the chunk number defined in the step, but I need to wait until get all items then write final report. how can I do that?
public class ReportItemWriter implements ItemWriter<ReportItem> {
private List<ReportItem> allItems = Lists.newArrayList();
...
public void write(List<? extends ReportItem> reportItems) throws Exception {
allItems.addAll(reportItems);
writeReport(allItems); <-- here it only write chunk of items to the report
}