I have the following configuration in the file dataloader.properties
filepath = /xx
exchange = M00,M01,MF2,MF3
I need the MultiResourcePartitioner to process the files from all these folders such as
/xx/M00/*
/xx/M01/*
/xx/MF2/*
/xx/MF3/*
There can be other folders under /xx , but it should process only the files from folder M00,M01,MF2,MF3
<bean id="filepartitioner" class="org.springframework.batch.core.partition.support.MultiResourcePartitioner">
<property name="resources" value="classpath:./${filepath}" />
</bean>
kindly let me know , how to do this in spring batch .I had a look at a filesystemresource and ResourcesItemReader api , but no idea how to inject it to the MultiResourceParitioner
simple solution – if possible at all
if the pattern stays stable you could try it with
customized MultiResourcePartitioner – filters folders
a working example is available on my github repo at https://github.com/langmi/spring-batch-examples-playground/blob/4e733dce09daffca1c10d4907f410ac5bead6887/src/main/resources/spring/batch/job/file-multiresourcepartitioner-filter-folders-factory-job.xml, check file-multiresourcepartitioner-filter-folders-job.xml
more pluggable solution: Factory which creates the Resources for the MultiResourcePartitioner
a working example is available on my github repo at https://github.com/langmi/spring-batch-examples/tree/master/playground/src/main/resources/spring/batch/job, check file-multiresourcepartitioner-filter-folders-factory-job.xml
you can pick the method to set the Resources array from List all files from a directory recursively with Java and similar solutions across the net, only thing left is the filter, there is one solution in the link provided