【发布时间】:2017-02-17 06:41:33
【问题描述】:
我想在不同的骆驼路线中重用蓝图 DSL 定义的转换步骤,但不知道如何实现。
这里举个例子:
<camelContext id="jms-context" xmlns="http://camel.apache.org/schema/blueprint">
<route id="inputAqTest8">
<from id="_fromAqTest8" uri="aqTest8:queue:QUELOGENTRY"/>
<!-- some complicated transformation here -->
<to id="_to1" uri="umChannel:topic:Input"/>
</route>
<route id="inputAqTest12">
<from id="_fromAqTest12" uri="aqTest12:queue:QUEPOSTDATA"/>
<!-- some complicated transformation here -->
<to id="_to2" uri="umChannel:topic:Input"/>
</route>
</camelContext>
我已经通过将转换和交付移动到由直接组件连接的自己的路线来优化这一点。
<camelContext id="jms-context" xmlns="http://camel.apache.org/schema/blueprint">
<route id="inputAqTest8">
<from id="_fromAqTest8" uri="aqTest8:queue:QUELOGENTRY"/>
<to id="_to1" uri="direct:process"/>
</route>
<route id="inputAqTest12">
<from id="_fromAqTest12" uri="aqTest12:queue:QUEPOSTDATA"/>
<to id="_to2" uri="direct:process"/>
</route>
<route id="process">
<from id="_from1" uri="direct:process"/>
<!-- some complicated transformation here -->
<to id="_to" uri="umChannel:topic:Input"/>
</route>
</camelContext>
这完美地重用了转换逻辑。但是由于直接同步“调用”,路由不再是独立的。另外,我现在只有一个生产者放慢了速度,因为转换后的消息不会发生并行传递(这也是我不想将所有消息合并到单个路由中的原因)。
那么我怎样才能充分利用这两种方法 - 重用转换的定义并保持路由独立?提前感谢您的想法。
【问题讨论】:
标签: apache-camel blueprint-osgi