Announcement Announcement Module
Collapse
No announcement yet.
FlatFileItemWriter writing multiple times instead of one time Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • FlatFileItemWriter writing multiple times instead of one time

    Hi,
    I am developing a POC to read records from flat file and writing it to another flat file. My Item reader implementation class reads 2 lines from the input file adding it into the List and passing it to FlatFileItemWriter. Now the list size is 2. When writing the FlatFileItemWriter calling the toString() method (I think so) of List 2 times and printing it into the out file.

    My field set mapper converts the line to Country POJO object and returning it to ItemReader. The List class in ItemReader class adds Country POJO object into it and passing it to the ItemWriter.

    Refer the two files for better understanding



    Input file
    NationUSA, WashingtonD.C, Newyork
    NationINDIA, Delhi, Mumbai

    Output file

    Country [Name=USA, Capitol=WashintonD.C, FinanceCapitol=Newyork],Country [Name=INDIA, Capitol=Delhi, FinanceCapitol=Mumbai]
    Country [Name=USA, Capitol=WashintonD.C, FinanceCapitol=Newyork],Country [Name=INDIA, Capitol=Delhi, FinanceCapitol=Mumbai]

    My question here is, why i am seeing the records for 2 times instead of only 1? My expected Output file is mentioned below

    Expected Output file

    Country [Name=USA, Capitol=WashintonD.C, FinanceCapitol=Newyork],Country [Name=INDIA, Capitol=Delhi, FinanceCapitol=Mumbai]
Working...
X