我有以下情况。如果由于某种原因FTP上传失败(在这种情况下我输入了错误的凭据),则会正确调用catch异常策略,但我仍然在日志文件中看到消息Upload complete.
。
为什么在发生异常后流程会继续执行?
<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>
答案 0 :(得分:2)
因为传入的MuleEvent是异步的。尝试设置processiingStrategy =&#34;同步&#34; on theflow:
<flow name="mainFlow" doc:name="mainFlow" processingStrategy="synchronous">
....
</flow>