我在我的JVM中运行了Camel,并且hawtio已连接到它。我可以在hawtio JMX选项卡中看到Camel详细信息。当我更改camelcontex.xml中的任何内容并重新启动karaf时,更改未反映在hawtio中。

因此,我无法调试路由hawtio。

有人可以建议任何配置,以便更改开始体现在hawtio中,我可以通过hawtio调试我的路由。

我的CamelContex.xml

<route id="cbr-route">
            <from id="_from1" uri="file://C:/temp/camel"/>
            <log id="_log1" message="Receiving order ${file:name}"/>
            <choice id="_choice1">
                <when id="_when1">
                    <xpath id="_xpath1">/order/customer/country = 'UK'</xpath>
                    <log id="_log2" message="Sending order ${file:name} to the UK"/>
                    <to id="_to1" uri="file:work/cbr/output/uk"/>
                </when>
                <when id="_when2">
                    <xpath id="_xpath2">/order/customer/country = 'US'</xpath>
                    <log id="_log3" message="Sending order ${file:name} to the US"/>
                    <to id="_to2" uri="file:work/cbr/output/us"/>
                </when>
                <otherwise id="_otherwise1">
                    <log id="_log4" message="Sending order ${file:name} to another country"/>
                    <to id="_to3" uri="file:work/cbr/output/others"/>
                </otherwise>
            </choice>
            <log id="_log5" message="Done processing ${file:name}"/>
        </route>


hawtio源选项卡路由

<route xmlns="http://camel.apache.org/schema/spring" id="cbr-route">
        <from uri="file:work/cbr/input" id="_from1"/>
        <log message="Receiving order ${file:name}" id="_log1"/>
        <choice id="_choice1">
            <when id="_when1">
                <xpath>/order/customer/country = 'UK'</xpath>
                <log message="Sending order ${file:name} to the UK" id="_log2"/>
                <to uri="file:work/cbr/output/uk" id="_to1"/>
            </when>
            <when id="_when2">
                <xpath>/order/customer/country = 'US'</xpath>
                <log message="Sending order ${file:name} to the US" id="_log3"/>
                <to uri="file:work/cbr/output/us" id="_to2"/>
            </when>
            <otherwise id="_otherwise1">
                <log message="Sending order ${file:name} to another country" id="_log4"/>
                <to uri="file:work/cbr/output/others" id="_to3"/>
            </otherwise>
        </choice>
        <log message="Done processing ${file:name}" id="_log5"/>
    </route>


非常感谢Advanced。

最佳答案

如果您是说要从hawtio Web控制台更改Camel XML,则这些更改不是永久性的,它们仅在运行时在内存中更改。如果需要永久更改,则需要更改源代码,然后重新生成并重新部署到karaf。

但是,Karaf也支持将单个xml文件复制到deploy文件夹来部署它。然后,您可以对该文件进行更改并保存,karaf应该会检测到文件更改并自动重新部署。

09-27 21:29