骡子请求回复在异常时挂起

时间:2015-11-16 13:26:59

标签: mule

我有一个骡子流,我配置了请求回复范围。流程如下:

<flow name="RequestReplyFlow">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/test" doc:name="HTTP" />
    <set-payload value="#['Sample Payload']" doc:name="Set Payload" />
    <request-reply doc:name="Request-Reply">
        <vm:outbound-endpoint exchange-pattern="one-way" path="request" doc:name="VM" />
        <vm:inbound-endpoint exchange-pattern="one-way" path="reply" doc:name="VM" />
    </request-reply>
</flow>

<flow name="RequestReplyFlow1">
    <vm:inbound-endpoint exchange-pattern="one-way" path="request" doc:name="VM" />
    <logger message="Executing with payload: #[payload]" level="INFO" doc:name="Logger" />
    <component class="org.ram.BusinessComponent" doc:name="Java" />
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger level="INFO" doc:name="Logger"/>
    </catch-exception-strategy>
</flow>

当组件org.ram.BusinessComponent抛出异常时,调用上述流的浏览器被挂起,根本没有响应。

org.ram.BusinessComponent没有抛出异常时,浏览器会收到响应。

有人可以解决这个问题吗?

1 个答案:

答案 0 :(得分:3)

我可以在Mule 3.6.2中重现这个问题。问题是因为当抛出异常时,流不会重定向到请求 - 回复以继续流,在这些情况下,您可以通过添加“vm:outbound-endpoint”在“catch-exception”中手动指定重定向“用”回复“路径。这是一个例子:

<flow name="RequestReplyFlow">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/test" doc:name="HTTP" />
    <set-payload value="#['Sample Payload']" doc:name="Set Payload" />
    <request-reply doc:name="Request-Reply">
        <vm:outbound-endpoint exchange-pattern="one-way" path="request" doc:name="VM" />
        <vm:inbound-endpoint exchange-pattern="one-way" path="reply" doc:name="VM" />
    </request-reply>
</flow>

<flow name="RequestReplyFlow1">
    <vm:inbound-endpoint exchange-pattern="one-way" path="request" doc:name="VM" />
    <logger message="Executing with payload: #[payload]" level="INFO" doc:name="Logger" />
    <component class="org.ram.BusinessComponent" doc:name="Java" />
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger level="INFO" doc:name="Logger"/>
        <vm:outbound-endpoint exchange-pattern="one-way" path="reply" doc:name="VM" />
    </catch-exception-strategy>
</flow>