Apache的骆驼FTP消费者一次又一次地加载相同的文件 [英] Apache Camel ftp consumer loads the same files again and again

查看:215
本文介绍了Apache的骆驼FTP消费者一次又一次地加载相同的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Spring配置

I have following spring configuration

<?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=*******&amp;noop=true&amp;stepwise=false&amp;binary=true&amp;consumer.delay=10s&amp;recursive=true&amp;filter=#fileFilter" />
            <process ref="downloadLogger" />
            <to uri="file:data/outbox" />
        </route>
    </camelContext>

</beans>

在ftp身边,我有,我想下载的文件3个文件夹。我想达到以下情形:

At the ftp side I have 3 folders with files which I want to download. I want to achieve following scenario:


  1. 在FTP是文件(isntance 5)在第一数据拉动消费定额加载这些​​文件复制到目标文件夹

  2. 在第二次尝试加载文件,FTP状态还是一样的(5档)和骆驼FTP消费者少了点什么(除了检查新文件)

  3. 要FTP到达新的2个文件,并在此数据拉动消费仅下载这些新的两个文件

目前,我目前的解决方案,每次下载的所有文件,当我运行数据加载过程中,我怎么能管理有关下载的文件,重复的prevent下载(我的意思是已复制从FTP文件)的信息,我可以写我的自己的过滤器将过滤掉已经下载的文件,但我相信应该有内置的功能,这将给我这个的CONTROLE(也许idempotentRepository,其实我不知道)...

At the moment my current solutions downloads all files each time when I run dataload process, how I can manage information about downloaded files to prevent downloads of duplicates (I mean already copied files from ftp), I can write my own filter which will filter out already downloaded files but I belive there should be built in feature which will give me controle of this (maybe idempotentRepository, actually I am not sure)...

推荐答案

您需要的,如果你想骆驼能够记住哪些文件它pviously $ P $下载,重启之间使用持久幂等资料库。

You need to use a persistent idempotent repository if you want Camel to be able to remember which files it previously have downloaded, between restarts.

您需要设置上的FTP端点此选项:idempotentRepository

You need to set this option on the ftp endpoint: idempotentRepository

在这里看到更多的细节: http://camel.apache.org/file2
(注:该FTP组件的继承的从文件组件的选项)

See more details here: http://camel.apache.org/file2 (Note: The FTP component inherits the options from the file component.)

有wiki页面如何使用不同的商店上的一些例子。而且你还可以建立你的定制店。

There are some examples on the wiki page how to use different stores. And you can also build you custom store.

这篇关于Apache的骆驼FTP消费者一次又一次地加载相同的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆