Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
spring-projects-issues opened this issue Apr 28, 2016 · 0 comments

Comments

@spring-projects-issues
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants