Mule响应阶段什么时候会被忽略?

时间:2015-01-10 04:20:56

标签: mule response

我正在阅读 Mule in Action 一书以了解response phase。作者说:

Finally, the last thing to consider is that the outcome of the response phase is ignored if the flow response is returned via reply-to routing.

我不太了解。谁能让我理解它?提前谢谢。

1 个答案:

答案 0 :(得分:2)

这是一个例子。这里请求 - 应答路由器将添加一个replyTo头,因此流'replyto'的结果被发送回'replytoout'队列。它将在请求阶段结束时返回结果,而不会调用响应阶段。

如果你运行它,你应该看到以下记录:

  

最终价值::: B

而不是'C',因为忽略了响应阶段

<flow name="replytotest">
        <poll frequency="60000">
            <logger level="INFO" message="Starting" />
        </poll>

        <set-payload value="A" />

        <request-reply>
            <vm:outbound-endpoint address="vm://replytoin" />
            <vm:inbound-endpoint address="vm://replytoout" />
        </request-reply>

        <logger level="INFO" message="Final value::: #[payload] " />
    </flow>

    <flow name="replyto">
        <vm:inbound-endpoint address="vm://replytoin" />

        <set-payload value="B" />

        <response>
            <set-payload value="C" />
        </response>
    </flow>