ule子批次无法开始

问题描述 投票:0回答:1

我已经使用SFTP输入创建了一个Mule批处理作业,它将无法检索csv文件。 将相同的组件移至工作流后,SFTP输入将正确轮询并检索文件。

如何获取SFTP输入以轮询并检索输入文件?

ule流XML:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ftp="http://www.mulesoft.org/schema/mule/ftp" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:sftp="http://www.mulesoft.org/schema/mule/sftp" xmlns:batch="http://www.mulesoft.org/schema/mule/batch" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/sftp http://www.mulesoft.org/schema/mule/sftp/current/mule-sftp.xsd
http://www.mulesoft.org/schema/mule/batch http://www.mulesoft.org/schema/mule/batch/current/mule-batch.xsd
http://www.mulesoft.org/schema/mule/ee/ftp http://www.mulesoft.org/schema/mule/ee/ftp/current/mule-ftp-ee.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/ftp http://www.mulesoft.org/schema/mule/ftp/current/mule-ftp.xsd">
    <ftp:connector name="FTP" pollingFrequency="1000" validateConnections="true" doc:name="FTP"></ftp:connector>
    <sftp:connector name="SFTP" validateConnections="true" doc:name="SFTP" pollingFrequency="10"></sftp:connector>
    <http:request-config name="HTTP_Request_Configuration" host="${host}" port="${userprocess.port}" doc:name="HTTP Request Configuration"></http:request-config>
    <batch:job name="userbatch">
        <batch:input>
            <sftp:outbound-endpoint exchange-pattern="request-response" connector-ref="SFTP" host="localhost" port="2222" path="//input" user="${ftp.user}" password="${ftp.password}" responseTimeout="10000" doc:name="SFTP"/>
        </batch:input>
        <batch:process-records>
            <batch:step name="Batch_Step">
                <object-to-string-transformer mimeType="application/csv" doc:name="Object to String"></object-to-string-transformer>
                <object-to-byte-array-transformer doc:name="Object to Byte Array"></object-to-byte-array-transformer>
                <logger message="#['Record ' +flowVars.counter +' being processed: ' + payload]" level="INFO" doc:name="Logger"></logger>
            </batch:step>
        </batch:process-records>
        <batch:on-complete>
            <sftp:outbound-endpoint exchange-pattern="one-way" connector-ref="SFTP" outputPattern="#[message.inboundProperties.originalFilename+'.processed']" host="localhost" port="2222" path="//output" user="${ftp.user}" password="${ftp.password}" responseTimeout="10000" duplicateHandling="addSeqNo" keepFileOnError="true" doc:name="SFTP"></sftp:outbound-endpoint>
        </batch:on-complete>
    </batch:job>
</mule>

CSV档案:

1,user1

谢谢

csv mule sftp batch-processing anypoint-studio
1个回答
0
投票

batch:input需要为Collection batch:process-records生成Collection,Iterable等,以使其在每个记录上单独起作用。 您只是传递整个文件流。

同样在上面的用例中,根本不需要批处理模块,除非您计划添加每条记录处理。

有关所有步骤的工作方式的更多信息,请参见: https : //docs.mulesoft.com/mule-user-guide/v/3.7/batch-processing

© www.soinside.com 2019 - 2024. All rights reserved.