在Camel中使用幂等读锁定时无法重命名文件警告

时间:2016-10-14 09:44:49

标签: apache-camel

我在具有2个节点的集群环境中使用Camel版本2.17.1来处理文件。我在文件使用者端点中使用幂等读取锁,使用JDBCMessageIdRepository作为幂等存储库来阻止多个服务器尝试处理同一文件。

偶尔我会在一个节点的SystemOut日志中看到警告,说明当另一个节点成功处理同一个文件时,无法重命名文件。

警告示例:

[12/10/16 10:21:03:312 BST] 0000008f SystemOut     O 12 Oct 2016 10:21:03 [r-inboundCamelContext_Worker-1] FileConsumer      WARN  Endpoint[file://drop?delay=30000&idempotentKey=${file:name}-${file:modified}-${file:size}&idempotentRepository=#filesInIdempotentRepository&move=done/${date:now:yyyyMMdd}/${date:now:yyyyMMddHHmmssSSS}-${file:name}&moveFailed=error/${date:now:yyyyMMdd}/${date:now:yyyyMMddHHmmssSSS}-${file:name}&preMove=processing&readLock=idempotent&readLockRemoveOnCommit=true&runLoggingLevel=DEBUG&scheduler=quartz2&scheduler.cron=*+*+*+*+*+?] cannot begin processing file: GenericFile[drop\file-20161012_101320.xml] due to: Cannot rename file: GenericFile[drop\file-20161012_101320.xml] to: GenericFile[drop\processing\file-20161012_101320.xml]. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot rename file: GenericFile[drop\file-20161012_101320.xml] to: GenericFile[drop\processing\file-20161012_101320.xml]]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot rename file: GenericFile[drop\file-20161012_101320.xml] to: GenericFile[drop\processing\file-20161012_101320.xml]
                at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:115)
                at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:43)
                at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:367)
                at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:226)
                at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:190)
                at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
                at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
                at org.apache.camel.pollconsumer.quartz2.QuartzScheduledPollConsumerJob.execute(QuartzScheduledPollConsumerJob.java:61)
                at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
                at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
stack

有没有办法阻止两个节点尝试处理同一个文件?

0 个答案:

没有答案