Camel 中是否有 while 循环?

编程入门 行业动态 更新时间:2024-10-27 02:23:02
本文介绍了Camel 中是否有 while 循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-19 22:19:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/971493.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Camel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!