Skip to content

Skip functionality is not working properly in MongoItemReader scenario [BATCH-2503] #1101

Open
@spring-projects-issues

Description

@spring-projects-issues

nishant ranjan opened BATCH-2503 and commented

Skip exception class functionality is not working properly when MongoItemreader is being used.
Example:
<skippable-exception-classes>
<include class="org.springframework.core.convert.ConversionFailedException" />
</skippable-exception-classes>

Suppose 20 rows are fetched from MongoDB and at row number 15 configurable exception ".ConversionFailedException" is thrown from a custom class derived from Converter, (MessageContextReadConverter implements Converter<DBObject, MessageContext>)
. MessageContextReadConverter is set during mongoTemplate creation,.

Now, exception thrown at row number 15 is received in custom readlistener (public void onReadError(Exception ex)).

Issues:

  1. Spring batch is stuck at row number 15. It continuously calls MessageContextReadConverter and onReadError for same row number 15.
  2. skiplistener is never invoked.

Analysis:
MongoItemreader works on paging mechanism therefore skip functionality is not working.

Solution:

  1. Spring batch should provide MongoItem reader which is a cross implementation of both page and cursor techniques. Otherwise, reading each row from Mongo is huge task if data is large.

Kindly correct me if above analysis is in-correct.

I am implementing cursor based reader but again its not a solution as combination of cursor + paging is required.


Affects: 3.0.7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions