それぞれ 1 つのルートを含む 2 つの Camel コンテキストを持つ Camel ブループリント定義があります。
最初のコンテキスト ルートが呼び出され、次に 2 番目のコンテキストのルートが呼び出されます。2 番目のルートで例外がスローされ、onExceptionsetsがスローされた場合handled=true、最初のルートdoFinallyブロックでは最初のプロセッサのみが呼び出されます。
これが私のブループリントの定義です:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:camel="http://camel.apache.org/schema/blueprint"
          xsi:schemaLocation="
      http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
      http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
    <bean id="myException" class="java.lang.RuntimeException">
        <argument value="Booom" />
    </bean>
    <camelContext id="firstContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
        <route id="firstRoute">
            <from uri="direct-vm:start"/>
            <doTry>
                <to uri="log:FIRST_TRY"/>
                <to uri="direct-vm:generateException"/>
                <to uri="log:SECOND_TRY"/>
                <doFinally>
                    <to uri="log:FIRST_FINALLY"/>
                    <to uri="log:SECOND_FINALLY"/>
                </doFinally>
            </doTry>
            <log message="The message contains ${body}"/>
            <to uri="mock:result"/>
        </route>
    </camelContext>
    <camelContext id="secondContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
        <onException>
            <exception>java.lang.Exception</exception>
            <handled>
                <constant>true</constant>
            </handled>
        </onException>
        <route id="secondRoute">
            <from uri="direct-vm:generateException"/>
            <throwException ref="myException"/>
        </route>
    </camelContext>
</blueprint>
のみ<to uri="log:FIRST_FINALLY"/>が印刷されます。が見えません<to uri="log:SECOND_FINALLY"/>。ここで何か不足していますか?どんな助けでも大歓迎です。
Apache Servicemix 4.5.2 内で Camel 2.10.6 を使用しています。
よろしくドミニク