在Spring集成中借助mongo入站适配器分页数据 [英] paginated data with the help of mongo inbound adapter in spring integration

查看:53
本文介绍了在Spring集成中借助mongo入站适配器分页数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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.

推荐答案

实际上,我建议举一个New Feature

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆