骆驼中有一个while循环吗? [英] Is there a while loop in Camel?

查看:32
本文介绍了骆驼中有一个while循环吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 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>

这篇关于骆驼中有一个while循环吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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