如何在mule中处理使用请求回复路由器的异常

时间:2013-11-18 07:19:58

标签: mule fork-join

我在我的flow中使用以下fork和join模式。并行处理工作正常。但是,我遇到异常处理问题。我想为路由器的VM响应入站端点上发生的处理实现异常策略。但是,当我尝试从catch异常策略块中写入响应时,似乎没有任何反应。当有异常时,我能够从catch块中看到日志语句,但浏览器上的响应只是挂起。     请建议。

<flow name="forkAndJoinFlow" doc:name="forkAndJoinFlow">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="81" path="lowestprice" doc:name="HTTP"/>
        <not-filter doc:name="Not">
            <wildcard-filter pattern="*favicon*" caseSensitive="true"/>
        </not-filter>
        <request-reply>
            <all>
                <vm:outbound-endpoint path="shop1"/>
                <vm:outbound-endpoint path="shop2"/>
            </all>
            <vm:inbound-endpoint path="response">
                <message-properties-transformer>
                    <add-message-property key="MULE_CORRELATION_GROUP_SIZE" value="2" />
                </message-properties-transformer>
                <collection-aggregator />
            </vm:inbound-endpoint>
        </request-reply>
        <expression-transformer evaluator="groovy" expression="java.util.Collections.min(payload)" doc:name="Expression"/>
        <object-to-string-transformer doc:name="Object to String"/>
        <logger level="WARN" message="#[string:Lowest price: #[payload]]" doc:name="Logger"/>

<catch-exception-strategy doc:name="Catch Exception Strategy">
            <logger message="EXCEPTION:#[payload]" level="INFO" doc:name="Logger"></logger>
<!--Nothing happens after this-->

<object-to-string-transformer doc:name="Object to String"></object-to-string-transformer></catch-exception-strategy>

    </flow>

    <flow name="shop1Flow" doc:name="shop1Flow">

        <vm:inbound-endpoint path="shop1" doc:name="VM"/>
        <logger level="INFO" message="SHOP1 Flow..." doc:name="Logger"/>
        <expression-transformer evaluator="groovy" expression="new java.lang.Double(1000.0 * Math.random()).intValue()" doc:name="Expression"/>
        <logger level="WARN" message="#[string:Price from shop 1: #[payload]]" doc:name="Logger"/>


    </flow>

    <flow name="shop2Flow" doc:name="shop2Flow">

        <vm:inbound-endpoint path="shop2" doc:name="VM"/>
        <logger level="INFO" message="SHOP2 Flow..." doc:name="Logger"/>
        <expression-transformer evaluator="groovy" expression="new java.lang.Double(1000.0 * Math.random()).intValue()" doc:name="Expression"/>
        <logger level="WARN" message="#[string:Price from shop 2: #[payload]]" doc:name="Logger"/>`enter code here`
    </flow>

</mule>

0 个答案:

没有答案