Results 1 to 2 of 2

Thread: Returned Object from ItemProcessor

  1. #1
    Join Date
    Jan 2009
    Posts
    2

    Default 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. #2
    Join Date
    Dec 2005
    Location
    Lyon, France
    Posts
    311

    Default

    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).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •