how to read multiple flat files with different headers and process them at once using spring batch
15:05 03 Dec 2019

I have multiple files with different headers as shown below. The number of fields in each file is not the same. So technically we can't use spring batch MultiResourceItemReader to read them.

file1.txt
--------------
Id|Name

file2.txt
-----------
id|Dept

file2.txt
--------------
id|Salary|desig  

After reading all the files, I want the data of all the files to be available and would like to pass to processor to process them and do some lookups on data based on id and finally generate a file something like below

outputfile.txt

id|name|dept|salary|desig

Without processing them we can write them to the output file. But the only concern here is how to read the data from all the files and store data in Map or any data structure, and then apply business logic, and then write data to a single file. Is there a way to read these files parallel and store data that is available to the processor or next step?

java spring-batch