Apache camel ApacheCamel:onCompletion模式下的多个执行=";“在消费者之前”;
对不起我的英语,我会尽我最大的努力写这篇文章 我有这样一个xml文件:Apache camel ApacheCamel:onCompletion模式下的多个执行=";“在消费者之前”;,apache-camel,Apache Camel,对不起我的英语,我会尽我最大的努力写这篇文章 我有这样一个xml文件: <routes> <route id="id1"> <from uri="timer://foo?fixedRate=true&period=60s"/> <onCompletion mode="BeforeConsumer"> <log message="finish"/>
<routes>
<route id="id1">
<from uri="timer://foo?fixedRate=true&period=60s"/>
<onCompletion mode="BeforeConsumer">
<log message="finish"/>
</onCompletion>
<setBody>
<simple>Probando 1</simple>
</setBody>
<log message="working1"/>
<to uri="direct:test1"/>
</route>
<route id="id2">
<from uri="direct:test1"/>
<setBody>
<simple>Test2</simple>
</setBody>
<log message="working2"/>
<to uri="direct:test2"/>
</route>
<route id="id3">
<from uri="direct:test2"/>
<setBody>
<simple>Test3</simple>
</setBody>
<log message="working3"/>
</route>
</routes>
普罗班多1
测试2
测试3
如果从第一个路由中删除mode=“BeforeConsumer”,我会在日志中得到一个“finish”,但是如果我使用mode=“BeforeConsumer”的xml,我会得到三次消息(每个路由一次)。这是预期的行为吗
我需要onCompletion代码运行一次,但我也需要模式=“BeforeConsumer”奇怪。这看起来像一个骆驼虫,我无法想象这是工作的预期。作为一种解决方法,您可以将
onCompletion
移到
行下方,谢谢您的评论。我有很多变通办法,但我想知道我是否做错了什么。我想我会试着在骆驼虫追踪器上开一张罚单