Oct 5th, 2012, 11:50 AM
Not getting skipCount from stepExecution even if there are skipped records
I have step with reader,processor and writer with skippable exception FlatFileParseException and commit interval.
In reader's read method, I am expecting stepExecution to give me skipped count until now. The lines are getting skipped because of formatting issues and not able to map data type of the entity.
I am hoping spring batch to increment these counts if I have configured skippable exception in job.
Oct 8th, 2012, 11:55 AM
Any replies experts ?
We want to determine the line number of the file being read, we are getting read count but readSkipCount is always zero !
We see that skipCount is updated in FaultTolerantChunkProvider class in "read" method using "contribution.incrementSkipCount() but contribution is not applied to stepExecution until transaction is committed.
To determine the line number we are using method stepExecution.getReadCount() + stepExecution.getReadSkipCount().
Is this the right way to determine line number ? Please let me know if there is any other way.
Oct 10th, 2012, 09:40 AM
That's going to be the best bet. You are correct in your analysis. The read count is incremented as items are returned from the read method on the ItemReader. However if a row is skipped, the read skip count is incremented and the read count is not so the addition of the two would work on the initial run. The only concern would be on restarts. The previous skips are not included in the response of the getReadSkipCount. However, they are in the getStepSkipCount.
Oct 10th, 2012, 01:23 PM