Announcement Announcement Module
No announcement yet.
Not getting skipCount from stepExecution even if there are skipped records Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 tried,

    I am hoping spring batch to increment these counts if I have configured skippable exception in job.


  • #2
    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.


    • #3
      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.


      • #4
        You can access the line number in the LineMapper:,%20int%29