问题描述
限时送ChatGPT账号..Camel 中是否有 while 循环的想法?我们正在使用 Camel 进行批处理(我所知道的并不是 ESB 的真正职责).在 ESB 中处理消息时,我想继续检查其他内容的状态.我只能找到一个循环定义次数的循环,即用于测试或每 x 秒检查一次的石英计时器.这两个都不合适.
Is there an idea of a while loop in Camel? We are using Camel for doing batch processing (not really the remit of an ESB I know). I want to keep checking on the status of something else whilst I am processing messages in the ESB. I can only find a loop that loops for a defined number of times, i.e. for testing or a quartz timer that will check every x seconds. Neither of these are really suitable.
有什么建议吗,或者我只是在 ESB 的职责范围之外要求什么?
Any suggestions, or am I asking for something simply outside of the remit of an ESB?
推荐答案
做这样的事情怎么样:
<camelContext id="myContext">
<route id ="initializer">
<!--This will be created only once -->
<from uri="timer://foo?repeatCount=1"/>
<to uri="seda:mySedaQueue"/>
</route>
<route id ="myRoute">
<from uri="seda:mySedaQueue"/>
<choice>
<when>
<simple>{your condition if you want to continue}</simple>
...
<to uri="seda:mySedaQueue" />
</when>
<otherwise>
...
</otherwise>
</choice>
</route>
</camelContext>
这篇关于Camel 中是否有 while 循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论