I'm using spring-batch
to process multiple csv
files from a folder using spring-batch
. Similar as follows:
@Bean
public ItemReader<String> reader() {
MultiResourceItemReader<String> reader = new MultiResourceItemReader<>();
reader.setResources(new Resource[] {new FileSystemResource("/myfolder/*.csv")});
reader.setDelegate(new FlatFileItemReader<>(..));
return reader;
}
The jobs is a single thread executor.
Question: whenever new files are added to the folder, how can I add them to the list and import them automatically using the job?
It's about 30.000 files per day in this folder. Can I tell spring-batch to automatically detect new files?
Or would I always have to restart the job as soon as it has finished, so that it then starts to import the files the have been added while the job ran?