2015-12-31 38 views
1

我正在使用入站通道适配器轮询目录。但是,它始终在无限次地轮询相同的文件,而不是创建消息负载。极化的弹簧集成文件通道适配器轮询文件无限次并且不会创建消息负载

两个级别涉及:

1投票父目录和文件移动到Inprogess文件夹

2民意调查INPROGRESS目录,并创建消息负载

问题 - 它是轮询文件目前在进入目录无限期的时间,但它不创建任何消息有效载荷并调用作业。下面的配置为 。

<int-file:inbound-channel-adapter id="pollDataFile" 
    directory="file:////D:/Directory1" 
    channel="inboundFileChannel" auto-startup="true" filter="compositeFilter"> 
    <int:poller default="true" fixed-rate="5000" time-unit="MILLISECONDS"/> 
</int-file:inbound-channel-adapter> 

<int:service-activator id="moveFileToInProgress" ref="handler" input-channel="inboundFileChannel" output-channel="filesInProcess" /> 

    <bean id="handler" class="com.spring.batch.util.FileCopyService"/> 

    <int-file:outbound-channel-adapter 
     id="filesCopyToInProcess" channel="filesInProcess" 
     directory="file:////D:/InProgress" 
     auto-create-directory="false" delete-source-files="true"> 
</int-file:outbound-channel-adapter> 

<int-file:inbound-channel-adapter id="pollDataFileInProgress" 
     directory="file:////D:/InProgress" prevent-duplicates="true" 
     channel="filesInProcessToProcess" filter="compositeFilter"> 
     <int:poller default="true" fixed-rate="10000" time-unit="MILLISECONDS"/> 
    </int-file:inbound-channel-adapter> 

    <int:transformer id="prepareJobLaunchRequest" 
     input-channel="filesInProcessToProcess" output-channel="outboundJobRequestChannel"> 
     <bean class="com.spring.batch.util.FileMessageToJobRequest"> 
      <property name="job" ref="fileUploadJob" /> 
      <property name="fileParameterName" value="input.file.name" /> 
      <property name="beanReader" value="bean.reader" /> 
      <property name="beanWriter" value="bean.writer" /> 
      <property name="beanProcessor" value="bean.processor" /> 
     </bean> 
</int:transformer> 


<bean id="compositeFilter" 
    class="org.springframework.integration.file.filters.AcceptAllFileListFilter" /> 

回答

0

prevent-duplicates="true"增加了AcceptOnceFileListFilter让您有冲突的过滤器(接受所有接受一次);重复的文件名将不会被处理。

设置prevent-duplicates="false"

相关问题