I am new in spring batch so maybe I am wrong but I dont understand why write method in itemWriter need list of data:
void write(List<? extends T> items) throws Exception;
If I understand this process first is itemReader which read list of item. In first iteration read first item and so on... Next step is itemProcessor which gets data from itemReader. Then there is some processing and itemProcessor return new class which we want to save somewhere. So last step is itemWriter which get this class which return itemProcessor. So I dont know when itemWriter gets list of data. When I debugging my simple sample project there is still just one item in this list. Please someone explain me it
thx a lot
The answer is in this sequence diagram from the Spring Batch documentation.
If this is not clear enough, the documentation (again!) explains that Spring uses a chunck oriented processing style:
Spring Batch uses a 'Chunk Oriented' processing style within its most common implementation. Chunk oriented processing refers to reading the data one at a time, and creating 'chunks' that will be written out, within a transaction boundary.
Actually the Spring Batch documentation is quite good. I would recommend to read it if you are starting with Spring Batch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With