-
Oct 3rd, 2011, 02:32 PM
#1
Spring Batch SkipListener not called when exception occurs in reader
This is my step configuration. My skip listeners onSkipInWrite() method is called properly. But onSkipInRead() is not getting called. I found this by deliberately throwing a null pointer exception from my reader.
<step id="callService" next="writeUsersAndResources">
<tasklet allow-start-if-complete="true">
<chunk reader="Reader" writer="Writer"
commit-interval="10" skip-limit="10">
<skippable-exception-classes>
<include class="java.lang.Exception" />
</skippable-exception-classes>
</chunk>
<listeners>
<listener ref="skipListener" />
</listeners>
</tasklet>
</step>
I read some forums and intercahnged the listeners tag at both levels. Inside the chunk, and outside the tasklet. Nothing is working...
Experts please suggest
-
Oct 3rd, 2011, 11:03 PM
#2
Firstly the listener needs to be defined inside the chunk element.
Secondly the skip methods are not called immediately when exception is thrown, it is called immediately before transaction commit, after all chunk processing has completed.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules