Results 1 to 3 of 3

Thread: HeaderCallback even when you are appending to a file using FlatFileItemWriter

  1. #1
    Join Date
    Mar 2011
    Posts
    6

    Default 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?

  2. #2
    Join Date
    Jul 2011
    Posts
    15

    Default

    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?

    Thanks

  3. #3
    Join Date
    Mar 2011
    Posts
    6

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •