In the Spring documentation, the package for setting up a step shows a clear image of how the read and write process is performed.
read process ... read process // until
Corresponding (according to the document):
List items = new Arraylist(); for(int i = 0; i < commitInterval; i++){ Object item = itemReader.read() Object processedItem = itemProcessor.process(item); items.add(processedItem); } itemWriter.write(items);
However, when I debug and put a breakpoint in the reader method and a breakpoint in the processor process method, I see the following behavior:
read ... read // until
So is the documentation wrong? Or am I missing a configuration to make it behave like documentation (I can't find anything there).
The problem that I have is that each subsequent read now depends on the state of the processor. A reader is a composite that reads two sources in parallel, depending on the elements read in one of the sources, only the first, second, or both sources are read during one read operation. But the status of which reading sources is done in the processor. Currently, the only solution goes for commit-interval 1, which is not very optimal for performance.
source share