Spring package FlatFileItemReader reads multiple files

According to spring batch documents , they do not recommend using MuliResourceItemReader due to a reboot problem and recommend using one file in each folder.

β€œIt should be noted that, as with any ItemReader, adding extra input (in this case a file) can cause potential problems during restart. It is recommended that batch jobs work with their own directories until they are successful completed. "

If I have a folder with the following structure dest / < timestamp> /file1.txt, file2.txt

How to configure FlatFileItemReader to read a template file for each folder in the path.

+5
source share
2 answers

I would prefer the Spring Integration Project to read files from a directory, since it is not a Spring Business Batch Framework for polling a directory.

In the most basic Spring Integration scenario, it will poll the files in the directory, and for each file it will run a task with the file name as a parameter. This eliminates the logic of polling files from your batch jobs.

I have to offer this Dave Syer for basic concepts integrating these two technologies. Take a look at the FileToJobLaunchRequestAdapter sections

The source code for this adapter will also help you understand the insides.

+3
source

text/csv org.springframework.batch.item.file.MultiResourceItemReader.

.

http://parameshk.blogspot.in/2013/11/spring-batch-flat-file-reader-reads.html

+1

All Articles