Class MongoPagingItemReader<T>
- Type Parameters:
T
- type of items to read
- All Implemented Interfaces:
ItemReader<T>
,ItemStream
,ItemStreamReader<T>
,org.springframework.beans.factory.InitializingBean
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
-
Field Summary
Fields inherited from class org.springframework.batch.item.data.MongoItemReader
collection, fields, hint, parameterValues, query, queryString, sort, template, type
Fields inherited from class org.springframework.batch.item.data.AbstractPaginatedDataItemReader
page, pageSize, results
-
Constructor Summary
-
Method Summary
Methods inherited from class org.springframework.batch.item.data.MongoItemReader
afterPropertiesSet, convertToSort, doPageRead, replacePlaceholders, setCollection, setFields, setHint, setParameterValues, setQuery, setQuery, setSort, setTargetType, setTemplate
Methods inherited from class org.springframework.batch.item.data.AbstractPaginatedDataItemReader
doClose, doOpen, doRead, jumpToItem, setPageSize
Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
Methods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, getName, setExecutionContextName, setName
-
Constructor Details
-
MongoPagingItemReader
public MongoPagingItemReader()Create a newMongoPagingItemReader
.
-