Announcement Announcement Module
Collapse
No announcement yet.
can we have two writers for a job ? one for exception and one for success ?? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • can we have two writers for a job ? one for exception and one for success ??

    Hello Everyone ,

    Am working on POC of Spring Batch ,I have to compare the data in flat file and data base and need to route the matching rows to success table and not matching rows to exception table .How can we do this ? Is it possible to do with two writers ? please let me know .I got struck up here since two days and refering Spring batch in action but am not able to figure it out .

    Thanks

  • #2
    Is an exception actually thrown for the error items or are they just ones that are identified via processing as being "errors"? If it's the latter, you can writer your own ItemWriter that wraps two other ItemWriters. In your ItemWriter, you would determine what type of record it is and delegate the write to the appropriate writer.

    If it's the former, you could use a skip listener to do the writing for the error records.

    Comment

    Working...
    X