Announcement Announcement Module
No announcement yet.
Read and Write Skip Behaviou Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Read and Write Skip Behaviou

    I have a job that reads a flat file of 11 records. I skip 1 item in reader and 4 in writers. I have one Skiplistener with SkipInRead() and SkipInWrite() method which simple logs the skip message in DB. Why my onSkipInRead is being called multiple times i.e. 3 times in this case which in result logs same message in DB 3 times. OnSkipinWrite works fine

    <job id="ex_Job">
    		<step id="load">
    				<chunk reader="reader" writer="writer" commit-interval="3" skip-limit="10">
    						<include class="org.springframework.batch.item.file.FlatFileParseException" />
    						<include class="org.springframework.batch.item.file.transform.IncorrectLineLengthException" />
    						<include class="org.springframework.dao.DataIntegrityViolationException"/>
    					<listener ref="genericSkipListener" />
    	public class GenericSkipListener extends AbstractBaseSkipListener implements
            SkipListener<FieldSet, FieldSet> {
        private static final Log LOGGER = LogFactory.getLog(GenericSkipListener.class);
        private SkipedItemsDao skipedItemsDao;
        public void onSkipInRead(final Throwable t) {
            LOGGER.warn("[" + getJobName() + "] onSkipInRead:" + t);
            skipedItemsDao.saveReadSkippedItem(createReadSkipedItem("READ", "", t));
        public void onSkipInWrite(final FieldSet item, final Throwable t) {
            LOGGER.warn("[" + getJobName() + "] onSkipWrite:" + t);
  "WRITE", item.toString(), t));
        public void onSkipInProcess(final FieldSet item, final Throwable t) {
            LOGGER.warn("[" + getJobName() + "] onSkipInProcess:" + t);
  "PROCESS", item.toString(), t));
    My onSkipInRead() method is being call multiple times for the same item. Any idea guys ?
    Last edited by amique; Feb 24th, 2012, 12:31 AM.

  • #2
    Any idea guys