I'm using Spring Boot v2.7.1 and Batch in my project. In this project, I'm reading FlatFile
and creating Multiple output FlatFile
by making the use of MultiResourceItemWriterBuilder
and clasifying it using ClassifierCompositeItemWriter
. While reading the FlatFile, there are few records (Type=REJECT etc)
which I don't even want to read and process it.
The file we're getting from the third party system and its not in our control and size of the FlatFile is around 20GB.
Is there any way if we can avoid reading such records using Spring Batch?
As per FlatFileItemReader
implementation there is no way to skip the record that you don't want to read. The simplest way (if you don't want to any customization), simply return null from the process and than that object will NOT be going to writer.
Another way you cant implement your own skipping logic FlatFileItemReader#setComments
or create another method and call at the appropriate place, this case you need custom implementation of FlatFileItemReader
.