我有以下Spring配置Apache的駱駝FTP消費者加載相同的文件一次又一次
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="downloadLogger" class="com.thomsonreuters.oa.sdi.camel.DownloadLogger" />
<bean id="fileFilter" class="com.thomsonreuters.oa.sdi.camel.IgnoreReadyFilesFilter" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="ftp://url_to_ftp?password=*******&noop=true&stepwise=false&binary=true&consumer.delay=10s&recursive=true&filter=#fileFilter" />
<process ref="downloadLogger" />
<to uri="file:data/outbox" />
</route>
</camelContext>
</beans>
在ftp方我有,我要下載的文件3個文件夾。我想達到以下情形:
- 在FTP上的文件(isntance 5)在第一數據拉動消費的固定量加載這些文件複製到目標文件夾
- 在第二次嘗試加載文件,FTP狀態仍然是相同的(5檔)和駱駝FTP消費者少了點什麼(除了檢查新文件)
- 到FTP到達新的2個文件,在這個數據上拉消費者只下載這些新的兩個文件
目前,我目前的解決方案每次都會下載所有文件un dataload進程,我如何管理下載文件的信息以防止下載重複文件(我的意思是已經從ftp複製文件),我可以編寫自己的篩選器,篩選出已經下載的文件,但是我相信那裏應該內置功能會給我這個控制權(也許idempotentRepository,實際上我不確定)...
什麼版本的駱駝您使用的是?這5個文件是在同一個文件夾中,還是在不同的子文件夾中? – 2011-04-19 07:42:19
駱駝版本是2.7.0。有1個根目錄和3個子文件夾,每個子文件夾可能包含不同數量的文件。更具體地說,讓我們考慮一個子文件夾最初包含5個文件,然後到這個文件夾到達另外2個文件。我想阻止下載已經在目標文件夾中的文件。 – endryha 2011-04-19 08:35:13
嗯noop = true也意味着冪等性。但是嘗試在uri中使用idempotent = true – 2011-04-19 14:05:54