OiO.lk Blog java How is the list of items received by the ItemWriter in spring batch accumulated?
java

How is the list of items received by the ItemWriter in spring batch accumulated?


In Java Spring batch, I understand that ItemReader reads one item at a time and passes it to the ItemProcessor.

Suppose my implementations are
ItemReader<InputItem> and ItemProcessor<InputItem, OutputItem> and thus the ItemWriter becomes
ItemWriter<OutputItem>.

But the ‘write’ method takes a ‘List’ of items like so

public interface ItemWriter<T> {
    void write(List<? extends T> var1) throws Exception;
}

which in my case i override it as

@Override
public void write(List<? extends OutputItem> emails) throws Exception {
    // some code
}

How is this List of items collected? Does the ItemWriter wait for the processor to pass "chunk size" number of items before it proceeds? Does the framework handle this? Where exactly does this process of accumulation take place?

I am using Java 8

I am new to Spring batch and want to know how configurable I can make my code to be. I implemented Spring batch while making a copy of a MySQL table and was curious about this



You need to sign in to view this answers

Exit mobile version