Mule exception strategy does not stop flow from pr

2019-08-05 20:19发布

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>

标签: ftp mule esb
1条回答
成全新的幸福
2楼-- · 2019-08-05 20:44

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

<flow name="mainFlow" doc:name="mainFlow" processingStrategy="synchronous">
    ....
</flow>
查看更多
登录 后发表回答