Mongo SpringData是否支持批量提取

时间:2015-01-23 08:22:14

标签: optimization batch-processing spring-data-mongodb

我有SOLR feed mechaniz,它从mongo base获取所有订单并处理它们(获取其他数据并创建SOLR文档)。 我的问题是记录数量超过100k,因此将它们全部提取到列表中并进行处理是错误的。

SpringData可以支持批处理列表查询吗?这样我可以处理较小的数据块并处理它们?

我可以这样工作:

interface Command {
/*
 Here I will define logic that transforms mongo entry list
 into SOLR documents and sends an update
*/
  void execute(List<D> input); // here I will put my logic
}

在我的服务中,我想像这样执行findAll:

Command commandExecutor = ...;//implement Executor
int batchSize = 500;
mongoTemplate.findAll(MyModel.class, commandExecutor , batchSize );

0 个答案:

没有答案
相关问题