Class MongoPagingItemReader<T>

Type Parameters:
T - type of items to read
All Implemented Interfaces:
ItemReader<T>, ItemStream, ItemStreamReader<T>, org.springframework.beans.factory.InitializingBean

public class MongoPagingItemReader<T> extends MongoItemReader<T>

Restartable ItemReader that reads documents from MongoDB via a paging technique.

If you set JSON String query MongoItemReader.setQuery(String) then it executes the JSON to retrieve the requested documents.

If you set Query object MongoItemReader.setQuery(Query) then it executes the Query to retrieve the requested documents.

The query is executed using paged requests specified in the AbstractPaginatedDataItemReader.setPageSize(int). Additional pages are requested as needed to provide data when the AbstractItemCountingItemStreamItemReader.read() method is called.

The JSON String query provided supports parameter substitution via ?<index> placeholders where the <index> indicates the index of the parameterValue to substitute.

The implementation is thread-safe between calls to AbstractItemCountingItemStreamItemReader.open(ExecutionContext), but remember to use saveState=false if used in a multi-threaded client (no restart available).

Since:
5.1
Author:
Michael Minella, Takaaki Iida, Mahmoud Ben Hassine, Parikshit Dutta
  • Constructor Details