Announcement Announcement Module
No announcement yet.
Returned Object from ItemProcessor Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Returned Object from ItemProcessor

    In my spring batch job I return null in the processor when I want to skip an item, as reported in ItemProcessor javadoc. It works ok when I use an ItemProcessorAdapter: the item is not passed to ItemWriter.

    If I use an AsyncItemProcessor to add multithread support, returning null from the same processor bean is not working. The null item is passed to ItemWriter, causing exception.

    Is this correct? How can I skip an item when I use AsyncItemProcessor?

  • #2
    the AsyncItemProcessor always returns a Future. Consider using a wrapper that would poll the Future and check if the Future returns null (assuming the delegate item processor returns null immediately for a to-be-filtered item, it should work).