Jms ApacheCamel:再次调用路由或动态路由
我将JBoss Fuse 6.1.0与骆驼2.10.0.redhat-60024一起使用。 路线列表已为人所知。例如:Jms ApacheCamel:再次调用路由或动态路由,jms,apache-camel,jboss6.x,Jms,Apache Camel,Jboss6.x,我将JBoss Fuse 6.1.0与骆驼2.10.0.redhat-60024一起使用。 路线列表已为人所知。例如:#开始、#步骤1、#步骤2、#步骤3、#完成 但我不知道顺序。或者有时可能不需要某些路线。我只知道在#路由器路由(请参见下面的代码) 例如:#开始,#步骤2,#步骤1,#步骤3,#完成。或#开始,#步骤1,#步骤3,#完成。或诸如此类 但是骆驼2.10.0没有像动态克劳特那样的东西。我决定这样做: <?xml version="1.0" encoding="UTF-8"?&
#开始、#步骤1、#步骤2、#步骤3、#完成
但我不知道顺序。或者有时可能不需要某些路线。我只知道在#路由器
路由(请参见下面的代码)
例如:#开始,#步骤2,#步骤1,#步骤3,#完成。
或#开始,#步骤1,#步骤3,#完成。
或诸如此类
但是骆驼2.10.0没有像动态克劳特那样的东西。我决定这样做:
<?xml version="1.0" encoding="UTF-8"?>
...
<camelContext id="blueprintContext" trace="true"
xmlns="http://camel.apache.org/schema/blueprint">
<route id="start">
<from uri="..." />
<to uri="vm:router" />
</route>
<route id="router">
<from uri="vm:router" />
<bean ref="stepGenerator" method="nextStep" />
<choice>
<when>
<simple>${header.step} contains 'step1'</simple>
<to uri="vm:step1" />
</when>
<when>
<simple>${header.step} contains 'step2'</simple>
<to uri="vm:step2" />
</when>
<when>
<simple>${header.step} contains 'step3'</simple>
<to uri="vm:step3" />
</when>
<when>
<simple>${header.step} contains 'finish'</simple>
<to uri="vm:finish" />
</when>
</choice>
</route>
<route id="step1">
<from uri="vm:step1" />
<log message="Step 1 started." />
<!-- Some logic -->
<to uri="vm:router" />
</route>
<route id="step2">
<from uri="vm:step2" />
<log message="Step 2 started." />
<!-- Some logic -->
<to uri="vm:router" />
</route>
<route id="step3">
<from uri="vm:step3" />
<log message="Step 3 started." />
<!-- Some logic -->
<to uri="vm:router" />
</route>
<route id="finish">
<from uri="vm:finish" />
<log message="Finished!" />
</route>
</camelContext>
...
${header.step}包含“step1”
${header.step}包含“step2”
${header.step}包含“step3”
${header.step}包含“finish”
假设我们有下一个序列:#开始,#步骤1,#步骤2,#步骤3,#完成
。如果您尝试运行,则会在#start->#router->#step1
处停止
在#步骤1中
不工作。如果你打两次电话给route,它将不起作用。为什么?
如何在骆驼2.10.0中解决这种情况?根据中介绍的动态路由器模式
版本2.5。我相信这会对你有用…Ohh。我在blueprint中有一个旧的XSD模式,它告诉我不存在的“动态路由”标记。谢谢你的警惕!