Jul 25th, 2011, 02:37 PM
HeaderCallback even when you are appending to a file using FlatFileItemWriter
I am trying to generate multiple reports within the same file. Each report has its own header and footer, since i am write to the file one report after another, the first report creates a new file and the subsequent reports just append to the existing file.
My problem is, i am not able to fire HeaderCallback when i am appending to the file. I guess FlatFileItemWriter skips HeaderCallback if you are appending to the file.
Can any one suggest me a work around to my problem?
Jul 27th, 2011, 05:33 AM
I have the same problem. I'm filling a text file in two steps, because it has two kind of registers groups (several registers per group). Each one of this groups has to be between a header and a footer (with group count). In appending mode I can't write the step 2 group header with the HeaderCallBack. żAny workaround idea?
Jul 28th, 2011, 09:55 AM
I did find a workaround, but i dont know if it is neat.
This can be achieved in 3 steps.
-1st step i write individual reports to seprate files (say report1 and report2).
-2nd step i read from report2 and append to report1 ( using PassThroughLineMapper ) .
-3rd step calls a Tasklet to delete report2.
And to pass values from one step to another use JobContext