无法从Anypoint Studio Mule 3.9中的mongodb 4.4.0连接器中轮询数据
我在mongodb中有一个集合,每天添加大约1000条记录,我试图获取所有单独的记录,并在任何位置使用cron计划程序或固定频率计划程序每小时获取这些记录。显然mongodb无法获取记录
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mongo="http://www.mulesoft.org/schema/mule/mongo" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/current/mule-mongo.xsd">
<flow name="_mlFlow">
<poll doc:name="Poll">
<fixed-frequency-scheduler frequency="20" timeUnit="SECONDS"/>
<mongo:find-documents config-ref="Mongo_DB" collection="actions" limit="20" doc:name="Mongo DB"/>
</poll>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
答案 0 :(得分:0)
捕获结果集时,必须进行转换。
<flow name="_mlFlow">
<poll doc:name="Poll">
<fixed-frequency-scheduler frequency="20" timeUnit="SECONDS"/>
<mongo:find-documents config-ref="Mongo_DB" collection="actions" limit="20" doc:name="Mongo DB"/>
</poll>
<dw:transform-message doc:name="prepForMongo">
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
payload]]></dw:set-payload>
</dw:transform-message>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
答案 1 :(得分:0)
您可以尝试删除轮询范围并仅使用mongo DB连接器吗?那应该消除该错误。