我无法捕获由Poller组件触发的基本org.mule异常,Mule仍在使用默认机制(尝试全局或本地)
如果抛出以下异常,我想在Log it self中打印一些个人用于测试目的,一旦正常工作,将进一步增强。
Message : Failed to move file "C:\Users\Administrator\Desktop\shared_folder\12131551.XML" to "C:\Users\Administrator\Desktop\archive\backup\12131551.XML.backup". The file might already exist.
Code : MULE_ERROR-3
Exception stack is:
1. Failed to move file "C:\Users\Administrator\Desktop\shared_folder\12131551.XML" to "C:\Users\Administrator\Desktop\archive\backup\12131551.XML.backup". The file might already exist. (org.mule.api.DefaultMuleException)
org.mule.transport.file.FileMessageReceiver:553 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/DefaultMuleException.html)
Root Exception stack trace:
org.mule.api.DefaultMuleException: Failed to move file "C:\Users\Administrator\Desktop\shared_folder\12131551.XML" to "C:\Users\Administrator\Desktop\archive\backup\12131551.XML.backup". The file might already exist.
at org.mule.transport.file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:553)
at org.mule.transport.file.FileMessageReceiver.access$400(FileMessageReceiver.java:62)
at org.mule.transport.file.FileMessageReceiver$2.process(FileMessageReceiver.java:414)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
这是我的PoC
<file:connector name="XML_poller" autoDelete="false" streaming="false" validateConnections="true" pollingFrequency="5000" doc:name="File"/>
<file:connector name="output" doc:name="File" autoDelete="false" streaming="false" validateConnections="true"/>
<flow name="exceptionStrategyExample" doc:name="exceptionStrategyExample">
<file:inbound-endpoint connector-ref="XML_poller" path="C:\Users\Administrator\Desktop\shared_folder" moveToDirectory="C:\Users\Administrator\Desktop\archive\backup"
moveToPattern="#[header:originalFilename].backup" doc:name="Poller" responseTimeout="10000">
<file:filename-wildcard-filter pattern="*.xml" caseSensitive="false"/>
</file:inbound-endpoint>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" method="POST" doc:name="HTTP"/>
<choice-exception-strategy>
<rollback-exception-strategy
when="exception.causedBy(java.lang.IllegalStateException)"
maxRedeliveryAttempts="3">
<logger message="Retrying shipping cost calc." level="WARN" />
<on-redelivery-attempts-exceeded>
<logger message="Too many retries shipping cost calc."
level="WARN" />
<set-payload value="Error: #[exception.summaryMessage]"/>
</on-redelivery-attempts-exceeded>
</rollback-exception-strategy>
<catch-exception-strategy doc:name="Catch Exception Strategy" when="exception.causedBy(org.mule.*)">
<logger message="************TEST***************" level="INFO" doc:name="Logger"/>
</catch-exception-strategy>
</choice-exception-strategy>
</flow>
根本没有做任何事......任何提示?