在Spring集成中借助mongo入站适配器分页数据 [英] paginated data with the help of mongo inbound adapter in spring integration
问题描述
我正在使用mongo入站适配器从mongo检索数据.目前,我正在使用以下配置.
I am using mongo inbound adapter for retrieving data from mongo. Currently I am using below configuration.
<int-mongo:inbound-channel-adapter
id="mongoInboundAdapter" collection-name="updates_IPMS_PRICING"
mongo-template="mongoTemplatePublisher" channel="ipmsPricingUpdateChannelSplitter"
query="{'flagged' : false}" entity-class="com.snapdeal.coms.publisher.bean.PublisherVendorProductUpdate">
<poller max-messages-per-poll="2" fixed-rate="10000"></poller>
</int-mongo:inbound-channel-adapter>
我的数据库中大约有20条记录可以满足上述查询的条件,但是当我给max-messages-per-poll值2时,我希望每次民意测验最多可以得到2条记录. 但是我正在获取符合上述查询条件的所有记录.不知道我在做什么错.
I have around 20 records in my data base which qualifies the mentioned query but as I am giving max-messages-per-poll value 2 I was expecting that i will get maximum 2 records per poll. but I am getting all the records which qualifies the mentioned query. Not sure what I am doing wrong.
推荐答案
Actually I'd suggest to raise a New Feature
JIRA ticket for that query-expression
to allow to specify org.springframework.data.mongodb.core.query.Query
builder, which has skip()
and limit()
options and from there your issue can be fixed like:
<int-mongo:inbound-channel-adapter
query-expression="new BasicQuery('{\'flagged\' : false}').limit(2)"/>
这篇关于在Spring集成中借助mongo入站适配器分页数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!