Mule 异常策略不会停止流程处理
Mule exception strategy does not stop flow from processing
我有以下场景。如果由于某种原因 FTP 上传失败(在这种情况下我输入了错误的凭据),捕获异常策略会被正确调用,但我仍然会在我的日志文件中看到消息 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>
因为传入的MuleEvent是异步的。尝试在流程上设置 processiingStrategy="synchronous":
<flow name="mainFlow" doc:name="mainFlow" processingStrategy="synchronous">
....
</flow>
我有以下场景。如果由于某种原因 FTP 上传失败(在这种情况下我输入了错误的凭据),捕获异常策略会被正确调用,但我仍然会在我的日志文件中看到消息 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>
因为传入的MuleEvent是异步的。尝试在流程上设置 processiingStrategy="synchronous":
<flow name="mainFlow" doc:name="mainFlow" processingStrategy="synchronous">
....
</flow>