骡子例外策略不会阻止处理流程

骡子例外策略不会阻止处理流程

本文介绍了骡子例外策略不会阻止处理流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下情况。如果由于某种原因导致FTP上传失败(在这种情况下,我输入了错误的凭证),则捕获异常策略被正确调用,但我仍然看到上传完成。日志文件。

I've the following scenario. If for some reason the FTP upload fails (in this case I entered wrong credentials), the catch exception strategy is called correctly, but I still see the message Upload complete. in my log files.

为什么发生异常后流程继续执行?

Why does the flow continue its execution after an exception occurs?

<flow name="mainFlow" doc:name="mainFlow">
    <vm:inbound-endpoint path="test" exchange-pattern="one-way" />

    <choice>
        <when expression="#[flowVars.fileToUpload != null]">
            <set-payload value="#[flowVars.fileToUpload]" />
            <ftp:outbound-endpoint host="${ftp.host}" port="${ftp.port}" user="${ftp.username}" password="${ftp.password}" path="${ftp.path.input}"  outputPattern="#[flowVars.fileName]" />
        </when>
        <otherwise>
            <logger doc:name="Logger"/>
        </otherwise>
    </choice>

    <logger message="Upload complete." level="INFO" />

    <catch-exception-strategy>
        <logger doc:name="Exception occurred"/>
    </catch-exception-strategy>
</flow>


推荐答案

因为传入的MuleEvent是异步的。尝试在流上设置processiingStrategy =synchronous:

Because the incoming MuleEvent is asynchronous. Try setting the processiingStrategy="synchronous" on theflow:

<flow name="mainFlow" doc:name="mainFlow" processingStrategy="synchronous">
    ....
</flow>

这篇关于骡子例外策略不会阻止处理流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:04