当前位置: 首页 > 知识库问答 >
问题:

Spring Integration File channel adapter轮询文件无限次且不创建消息有效负载

岳刚洁
2023-03-14

我正在使用入站通道适配器poling目录。但是,它一直在无限次地poling同一个文件,而不创建消息负载。

<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" />

共有1个答案

荆梓
2023-03-14

prevent-duplicates=“true”添加acceptonceFilelistFilter,这样就有了冲突的筛选器(全部接受和一次接受);不会处理重复的文件名。

设置prevent-duplicates=“false”

 类似资料:
  • 我正在尝试使用亚马逊SNS控制台中的发布endpoint将推送通知(PN)从我的应用服务器发送到android设备,该消息和消息结构为json,工作正常。 但是,当我试图实现相同的Java它的设备没有收到通知。 控制台上的响应 发布列表请求:{ target arn:arn:AWS:SNS:AP-south-1:818862955266:endpoint/GCM/Test app/a1ec 811

  • 安装失败,消息为无效文件:K:\project\app\build\中间产品\spit-apk\with_ImageProcessor\debug\slices\slice_0.apk.解决此问题的方法可能是卸载现有版本的apk(如果存在),然后重新安装。 警告:卸载将删除应用程序数据! 是否要卸载现有应用程序? 我运行我的项目在Android Studio2.3 beta 3.

  • 我可以在Mule Esb中看到两个不同的对象-消息和有效负载。但我无法理解两者的实际特征。有人能帮我理解一下吗?。

  • 需求:构建一个基于。NET的应用程序,该应用程序可以定期从IBM Websphere消息队列读取消息,并将这些消息保存到数据库中

  • 我有一个android应用程序,我试图使用库调用. net Web服务,但我有一个问题,当我运行我的项目时,我得到这样的错误: soapFault-faultcode:'a: InternalServiceFault'faultstring:'反序列化操作'yemeksorgusu'的请求消息体时出错。操作格式遇到无效的消息体。希望找到名称为'yemeksorgusu'和命名空间'mozaikke

  • 我创建了一个AngularJS应用程序,没有 我的一个输入字段是number。 现在我如何显示错误消息没有从名称? 当我在字段中输入任意字符时,它会在输入类中显示ng invalid ng invalid number tag(屏幕截图1)。当输入一些数字时,它会显示ng有效类(屏幕截图2)。所以我的代码是works。 但问题是我的错误消息不起作用。 我遵循以下教程:http://codepen.