Apr 27th, 2010, 10:24 AM
multiple file writers - multiple files
my project requires to take input from files that contain different record types and break up this file into multiple files based on the value of the fields.
Scenario that I have, is that I'm reading large file and have to break it up into 24 files, based on the index property value which could be [A-Z]. On top of that input file contains multiple record types, let's say 5 record types.
I order to read an input file, I'm using PatternMatchingCompositeLineMapper and it works great, does exactly what I need.
As for writing, I'm using CompositeItemWriter that delegates to custom ItemWrites. As far as I understand ItemWriter can write only to single resource, but in my case, it should be able to write into 24 resources based on the index value.
How would I make my ItemWriter let's say RecType1ItemWriter, RecType2ItemWriter.... write into out-a.txt or out-b.txt or out-z.txt based on the index property of RecType?
Any help is appreciated.