Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache camel 使用ApacheCammel sql组件选择查询一次返回1行_Apache Camel - Fatal编程技术网

Apache camel 使用ApacheCammel sql组件选择查询一次返回1行

Apache camel 使用ApacheCammel sql组件选择查询一次返回1行,apache-camel,Apache Camel,我正在使用SpringDSL编写一个sql路由,并使用sql组件。 如果我的查询返回100行。问题是我的处理器被调用了100次。我每60秒轮询一次数据库 因此,我的from查询就像消息的生产者一样,一次只发送一行 有没有办法在我的处理器中一次性获得100行的完整结果集,以便对这些数据进行操作 <from uri="sql:{{sql.selectQuery}}?delay=60s"/> <process ref="sqlProcessor" /> 浏览文档()我发现 从

我正在使用SpringDSL编写一个sql路由,并使用sql组件。 如果我的查询返回100行。问题是我的处理器被调用了100次。我每60秒轮询一次数据库

因此,我的from查询就像消息的生产者一样,一次只发送一行

有没有办法在我的处理器中一次性获得100行的完整结果集,以便对这些数据进行操作

<from uri="sql:{{sql.selectQuery}}?delay=60s"/>
<process ref="sqlProcessor" />

浏览文档()我发现

从Camel 2.11开始,此组件可以创建使用者(例如From())和生产者端点(例如to())

我把路线改成了

<from uri="timer://sqltimer?period=60s"/>
<to uri="sql:{{sql.selectQuery}}"/>
<process ref="sqlProcessor" />


这个很好用

您还可以将使用者配置为不使用迭代器,例如设置consumer.useIterator=false