Announcement Announcement Module
No announcement yet.
CompositeItemWriter writing to multiple files Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • CompositeItemWriter writing to multiple files


    Is there a way to conditionally write records into different files based on their certain criteria?

    I have started testing with 2 types of records. I am running Multithreaded batch job.
    Problem is, files are not created as expected. Records are written irrespective of their types.
    I have coded Custom compositeItemWriter(implementing ItemWriter) writing to two flatfileitemwriters conditionally. Write method of composite writer takes List<Object>, I have to iterate this list to identify each element's record type and then invoke flatfileitemwriter which again takes List as parameter.

    I am confused because FlatFileItemWriter takes List as parameter but not object.