0

我在集群环境中使用下面的文件连接器

<file:connector
    name="inputZip"
    pollingFrequency="1000"
    streaming="false"
    autoDelete="true"
    workDirectory="/home/sergio/compartilhado/temp">
    <service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory"/>
</file:connector>`

有时当集群的一个节点锁定一个文件时,另一个节点尝试读取同一个文件并抛出异常

15:37:37,826 ERROR [org.mule.exception.DefaultSystemExceptionStrategy] ([sample].inputZip.receiver.01) 
********************************************************************************
Message               : File "teste.zip" does not exist or cannot be read
Code                  : MULE_ERROR-11007
--------------------------------------------------------------------------------
Exception stack is:
1. File "teste.zip" does not exist or cannot be read (org.mule.api.DefaultMuleException)
  org.mule.transport.file.FileMessageReceiver:608 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/DefaultMuleException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.DefaultMuleException: File "teste.zip" does not exist or cannot be read
    at org.mule.transport.file.FileMessageReceiver.attemptFileLock(FileMessageReceiver.java:608)
    at org.mule.transport.file.FileMessageReceiver.processFile(FileMessageReceiver.java:290)
    at org.mule.transport.file.FileMessageReceiver.poll(FileMessageReceiver.java:238)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

我想在抛出此错误之前记录另一条消息或处理此错误。有人可以帮我弄这个吗?先感谢您

4

1 回答 1

0

我解决了扩展类 FileMessageReceiver 并覆盖以下方法的问题

public void processFile(File file) throws MuleException {
    try {
        super.processFile(file);
    } catch (Exception e) {
        logger.info("Fail to read file " + e);
    }
}

在我的连接器中,我在标签服务中添加了覆盖属性 messageReceiver="br.com.unimed.wsd.tiss.mule.batch.FileSampleMessageFactory"

于 2013-11-20T16:33:31.550 回答