Description
Mitsuyoshi Hasegawa opened BATCH-2541 and commented
I supporse that "<skippable-exception-class>" element does not satisfy users' purpose, and confuse them.
Details are shown below:
- We can't partition exceptions at each components surrounded <chunk> definition.
http://docs.spring.io/spring-batch/reference/htmlsingle/#configuringSkip
For examples above, it describes that if FileNotException occures, chunk processing is skipped.
But I want to change target exception to process each components, as below:
- If exceptions occure in ItemReader, want to skip and obtain next item.
- If exceptions occure in ItemProcessor, want to be "FAIL".
There are problems of poor usablity such as inability to change behaviors,
and I want to throw indivisual exception in each components.
such as ItemReaderException/ItemProcessorException (very simple examples)
- If skippable exception occures in ItemWriter, Chunk items implicitely skip and recovery as chunkSize = 1.
The behaviors of skip-and-recovery in ItemWriter is different from that
in ItemReader and ItemProcessor, obviously.
Since a <skippable-exception-class> element required to describe per <chunk> element,
I gave up adopting it because of unsuitable for my application desigin.
Details below:
- When skippable-exception occcures in ItemReader, skip-and-recovery re-process the chunk from the beggining.
- Chunk item is re-processed one by one, by FaultTolerantChunkProcessorはRecoveryCallback#scan().
- Re-processing even skipped chunk item, and rollback if exception occures again.
This behavior is refered to this article:
https://blog.codecentric.de/en/2012/03/transactions-in-spring-batch-part-3-skip-and-retry/
To make matters worse, this behavior is undocumented in the Spring Batch-Reference Docs.
I am afraid that it takes a long time for them to try to find cause by "unexpected" behavior.
Thus, I want to describe this behavior in detail at Batch-Reference Docs.
Affects: 3.0.7
Reference URL: http://docs.spring.io/spring-batch/reference/htmlsingle/#configuringSkip