Jun 30th, 2011, 04:49 AM
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?
Jul 4th, 2011, 06:17 AM
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).