Announcement Announcement Module
Collapse
No announcement yet.
onSkipInRead being called multiple times Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • onSkipInRead being called multiple times

    I have both ItemReader and ItemWriter that are expected to throw Exceptions, and I have a SkipListener configured as well. However, the onSkipInRead is being called multiple times on the same item.

    The javadoc seems to mention this:

    Code:
    	/**
    	 * Callback for a failure on read that is legal, so is not going to be
    	 * re-thrown. In case transaction is rolled back and items are re-read, this
    	 * callback will occur repeatedly for the same cause.  This will only happen
    	 * if read items are not buffered.
    	 * 
    	 * @param t cause of the failure
    	 */
    	void onSkipInRead(Throwable t);
    as well as in the reference:

    Code:
    5.1.7. Controlling Rollback
    By default, regardless of retry or skip, any exceptions thrown from the ItemWriter will cause the transaction controlled by the Step to rollback. If skip is configured as described above, exceptions thrown from the ItemReader will not cause a rollback. However, there are many scenarios in which exceptions thrown from the ItemWriter should not cause a rollback because no action has taken place to invalidate the transaction. For this reason, the Step can be configured with a list of exceptions that should not cause rollback.
    I tried adding the code below to my step config, but it remains the same:
    Code:
    <batch:no-rollback-exception-classes>
          <batch:include class="java.lang.Exception" />
    </batch:no-rollback-exception-classes>
    ChunkOrientedTasklet calls
    Code:
    chunkProvider.postProcess(contribution, inputs);
    multiple times on the same error.

    What should I do to make sure onSkipInRead is called only once given that ItemWriter throws Exception?

    Related threads: http://forum.springsource.org/showth...t=onSkipInRead

    http://forum.springsource.org/showth...t=onSkipInRead
Working...
X