Mule批处理自动删除源文件不起作用

时间:2015-12-08 06:47:31

标签: mule

SFTP连接器在批量处理中读取后不会删除ssource文件,而正常流程则会删除文件

我正在设置autoDelete =" true" SFTP连接器中的条件。任何人都可以建议如何处理这种情况

<context:property-placeholder location="dev.properties"/>
<encryption:config name="Encryption" defaultEncrypter="PGP_ENCRYPTER" doc:name="Encryption">
    <encryption:pgp-encrypter-config publicKeyRingFileName="keys/dev_pgp_wd_ecc_public.key.gpg" secretKeyRingFileName="keys/dev_pgp_wd_ecc_private.key.gpg" secretAliasId="${key.AliasId}" secretPassphrase="${key.Passphrase}" principal="${key.principal}"/>
</encryption:config>

<amqp:connector name="AMQP_Connector" validateConnections="true" host="${amqp.host}" doc:name="AMQP Connector" virtualHost="${amqp.virtualhost}" password="${amqp.password}" port="${amqp.port}" username="${amqp.user}"/>
<http:request-config name="HTTP_Request_PI" host="${pi.endpoint}" port="${pi.port}" doc:name="HTTP Request Configuration" basePath="${pi.path}" responseTimeout="30000">
    <http:basic-authentication username="${pi.username}" password="${pi.password}"/>
</http:request-config>
<smtp:connector name="SMTP_Alert" contentType="text/html" validateConnections="true" doc:name="SMTP"/>
<sftp:connector name="SFTP_Inbound_Connector" validateConnections="true" autoDelete="true" pollingFrequency="120000" doc:name="SFTP"/>

 <batch:job name="TestBatch" max-failed-records="-1">
    <batch:input>
        <sftp:inbound-endpoint connector-ref="SFTP_Inbound_Connector" host="${sftp.host}" port="${sftp.port}" path="/test/incoming/lt" user="${sftp.user}" password="${sftp.password}" responseTimeout="10000" doc:name="SFTP"/>

        <encryption:decrypt config-ref="Encryption" using="PGP_ENCRYPTER" doc:name="Encryption"/>
        <object-to-string-transformer doc:name="Object to String"/>
        <logger message="Decrypted" level="INFO" doc:name="Logger"/>
        <splitter expression="#[xpath3('/wd:Report_Data/wd:Report_Entry', payload, 'NODESET')]" doc:name="Splitter"/>
        <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
        <dw:transform-message doc:name="Transform Message" metadata:id="b7cbbbbb-d58b-439b-8684-5a6d0345d48c">
            <dw:input-payload doc:sample="empty.xml"/>
            <dw:set-payload></dw:set-payload>
        </dw:transform-message>
    </batch:input>
    <batch:process-records>
        <batch:step name="Batch_Step1">
            <json:object-to-json-transformer doc:name="Object to JSON"/>
            <batch:commit size="5" doc:name="Batch Commit">
                <amqp:outbound-endpoint exchangeName="${amqp.exchangeName}" queueName="${amqp.queueName}" responseTimeout="10000" encoding="UTF-8" mimeType="application/xml" connector-ref="AMQP_Connector" doc:name="AMQP"/>
            </batch:commit>
        </batch:step>

    </batch:process-records>
    <batch:on-complete>
        <logger message="#[flowVars.totalRecords.totalRecords]" level="INFO" doc:name="Logger"/>
        <logger message="#[flowVars.failedReocrds.failedReocrds]" level="INFO" doc:name="Logger"/>            
        <set-payload value="${mail.html}" doc:name="Set Payload" mimeType="text/html"/>
        <smtp:outbound-endpoint host="${mail.host}" port="${mail.port}" user="${mail.user}" password="${mail.password}" connector-ref="SMTP_Alert" to="${mail.receiver}" from="${mail.from}" subject="${IntegrationName}" responseTimeout="10000" doc:name="SMTP"/>
    </batch:on-complete>
</batch:job>

1 个答案:

答案 0 :(得分:0)

autoDelete和SFTP周围似乎存在漏洞: https://www.mulesoft.org/jira/browse/MULE-9144

所以也许这就是你遇到的问题,但是在正常流程中你说它有效。

因此,选项是与批处理执行组件一起尝试正常流程,因此您的FTP入站端点和集合创建是流程的一部分,并从该流程执行批处理。批处理元素的输入部分将为空。

https://docs.mulesoft.com/mule-user-guide/v/3.7/batch-processing#triggering-batch-jobs