【问题标题】:How to limit number of files to be processed in a mule flow?如何限制骡流中要处理的文件数量?
【发布时间】:2021-09-30 21:33:00
【问题描述】:

我有以下代码:

   <sftp:connector name="ImportStatusUpdateSFTP" validateConnections="true" doc:name="SFTP"/>

   <flow name="UpdateFlow1" doc:name="UpdateFlow1">
    <sftp:inbound-endpoint sizeCheckWaitTime="${sftpconnector.sizeCheckWaitTime}" connector-ref="ImportStatusUpdateSFTP" host="${sftp.host}" port="${sftp.port}"
        path="${sftp.path}" user="${sftp.user}" password="${sftp.password}" responseTimeout="${sftp.responseTimeout}"
        archiveDir="${mule.servicefld}${sftp.archiveDir}" archiveTempReceivingDir="${sftpconnector.archiveTempReceivingDir}" archiveTempSendingDir="${sftpconnector.archiveTempSendingDir}"
        tempDir="${sftp.tempDir}" doc:name="SFTP" pollingFrequency="${sftp.poll.frequency}">
        <file:filename-wildcard-filter pattern="*.xml"/>
    </sftp:inbound-endpoint>    
            
    <idempotent-message-filter idExpression="#[headers:originalFilename]"
        throwOnUnaccepted="true" storePrefix="Idempotent_Message" doc:name="Idempotent Message"
        doc:description="Check for processing the same file again.">
        <simple-text-file-store name="FTP_files_names"
            maxEntries="1000" entryTTL="-1" expirationInterval="3600"
            directory="${mule.servicefld}${idempotent.fileDir}" />
    </idempotent-message-filter>

    <object-to-byte-array-transformer doc:name="Object to Byte Array"/>

    <message-filter onUnaccepted="Status_UpdateFlow_XML_Validation_Failed">
        <mulexml:schema-validation-filter schemaLocations="xsd/StatusUpdate.xsd" returnResult="false" doc:name="Schema_Validation"/>
    </message-filter>
    
    <vm:outbound-endpoint exchange-pattern="one-way"
        path="StatusUpdateIN" doc:name="StatusUpdateVMO" />
        
    <default-exception-strategy>
        <vm:outbound-endpoint path="serviceExceptionHandlingFlow" />
    </default-exception-strategy>           
  </flow>

我的问题是,如果 SFTP (1000) 上有很多文件,它会将它们全部、转换、验证它们,然后将它们发送到出站端点,然后这个给应用程序处理部分带来压力。

有没有办法限制、拆分、批处理、过滤或任何其他类型的操作,只会将最大数量的消息/文件发送到出站端点。

【问题讨论】:

    标签: java mule


    【解决方案1】:

    在 Mule 3 中没有内置的通用方法来执行此操作。根据具体情况,可能有可能的解决方案。在 Mule 4 中,有一种在流中使用 maxConcurrency 属性的简单方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-31
      • 1970-01-01
      • 2017-11-12
      相关资源
      最近更新 更多