多实例上处理重复项的Spring Integration FTP文件适配器

多实例上处理重复项的Spring Integration FTP文件适配器,ftp,spring-integration,file-transfer,spring-integration-sftp,Ftp,Spring Integration,File Transfer,Spring Integration Sftp,我是SpringIntegration的新手,我正在尝试使用SpringIntegrationFTP文件适配器进行POC,以从FTP位置读取文件。 当我在两个Tomcat实例上部署应用程序时,我看到两个实例都在从FTP位置下载文件 我正在使用在我的机器上运行的虚拟FTP服务器(Xlight)。当我第一次将文件复制到远程目录时,两个实例都下载了文件,但当我再次将几个文件复制到远程文件夹时,两个实例都没有选择新添加的文件。 当我的应用程序部署在多个实例上时,我还希望实现的一个目标是确保一个文件只处理

我是SpringIntegration的新手,我正在尝试使用SpringIntegrationFTP文件适配器进行POC,以从FTP位置读取文件。 当我在两个Tomcat实例上部署应用程序时,我看到两个实例都在从FTP位置下载文件

我正在使用在我的机器上运行的虚拟FTP服务器(Xlight)。当我第一次将文件复制到远程目录时,两个实例都下载了文件,但当我再次将几个文件复制到远程文件夹时,两个实例都没有选择新添加的文件。 当我的应用程序部署在多个实例上时,我还希望实现的一个目标是确保一个文件只处理一次

请说明我遗漏了什么

下面是我的配置文件:

<bean id="ftpSessionFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
  <property name="host" value="${ftp.host}"/>
    <property name="port" value="${ftp.port}"/>
    <property name="username" value="${ftp.username}"/>
    <property name="password" value="${ftp.password}"/>

    <!-- whether server should connect to client's port or client should connect server port for initiating file transfer -->
    <!--  <property name="clientMode" value="${ftp.clientMode}"/> -->
    <!-- different file types involve ASCII , EBCDIC , BINARY (default) -->
    <!--  <property name="fileType" value="${ftp.fileType}"/> --> 
    <!-- <property name="bufferSize" value="${ftp.bufferSize}"/> -->
</bean>

<int-ftp:inbound-channel-adapter id="ftpInbound" channel="ftpInboundChannel" session-factory="ftpSessionFactory" charset="UTF-8" auto-create-local-directory="true" delete-remote-files="false" remote-directory="/SpringFtpOutbound/remote" remote-file-separator="/" preserve-timestamp="false" temporary-file-suffix=".writing" local-filter="myFilter" local-directory="/work/SpringFtpInbound_2">
  <int:poller fixed-rate="2000" max-messages-per-poll="1"/>
</int-ftp:inbound-channel-adapter>

<bean id="myFilter" class="org.springframework.integration.file.filters.CompositeFileListFilter">
  <constructor-arg>
    <list>
      <bean class="org.springframework.integration.file.filters.FileSystemPersistentAcceptOnceFileListFilter">
        <constructor-arg name="store" ref="metadataStore"/>
        <constructor-arg value="*.*"/>
      </bean>
      <bean class="org.springframework.integration.file.filters.SimplePatternFileListFilter">
         <constructor-arg value="*.xml" />
      </bean>
    </list>
  </constructor-arg>
</bean> 

<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" p:use-pool="true" p:host-name="localhost" p:port="6379" />
  <bean name="metadataStore" class="org.springframework.integration.redis.metadata.RedisMetadataStore">
    <constructor-arg name="connectionFactory" ref="redisConnectionFactory"/>
</bean>

<int-file:file-to-string-transformer id="myFileToStringTransfromer" input-channel="ftpInboundChannel" output-channel="transformChannel" />

<int-xml:xpath-splitter id="ftpFileSplitter" input-channel="transformChannel" output-channel="xpathSplitterChannel">
  <int-xml:xpath-expression expression="/bancsRequest/input"/>
</int-xml:xpath-splitter>

<int:transformer id="myCustomTransformer" ref="myTransformerBean" input-channel="xpathSplitterChannel" method="transform" output-channel="ftpOutboundChannel">
</int:transformer>

<bean id="myTransformerBean" class="com.ntrs.geh.ftp.file.poc.transformer.MyXmlPayloadTransformer"/>

<int-jms:outbound-channel-adapter id="outboundChannelAdapter" channel="ftpOutboundChannel" jms-template="ftpOutQueueJmsTemplate" >
</int-jms:outbound-channel-adapter>

使用相同的共享
元数据存储
方法,但用于
过滤器
。 为此,框架提供了
FtpPersistentAcceptOnceFileListFilter