Announcement Announcement Module
No announcement yet.
Skipping bad records Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Skipping bad records

    During input reading i'd like the FlatFileItemReader to skip bad records (i.e. records that cannot be mapped using the FieldSetMapper), but i'm not sure how to implement that. I've noticed there are a few interfaces like ItemSkipPolicy but unlike RetryPolicy there isn't a setter on either Step or ItemReader to place the policy on. The same holds true for ItemWriter, I also want to be able to skip bad items during output writing.

    Also it might be usefull for future reference to supply a sample job that demonstrates Spring Batch its skip capabilities.

  • #2
    In RC1 you can use SkipLimitStepFactoryBean to set a skip limit and skippable exception types (see skipSample job in latest trunk). Currently the logic is that when exception is thrown transaction is always rolled back, but the error item is skipped when encountered next time.

    There is a jira to allow skipping on the fly without rollback too: