mule 4 sftp file read is deleting file after file read

486 Views Asked by At

Using Mule 4.4 community edition . I am reading a file using mule's sftp connector :

    <dependency>
        <groupId>org.mule.connectors</groupId>
        <artifactId>mule-sftp-connector</artifactId>
        <version>1.4.1</version>
        <classifier>mule-plugin</classifier>
    </dependency>

Running code in dedug mode , after the file is read , I can still see the file on sftp location ( which is good ) , however it disappears after file read .... ( see below code )

<sftp:config name="SFTP_Config" doc:name="SFTP Config"
    timeBetweenSizeCheck="30" timeBetweenSizeCheckUnit="SECONDS">
    <sftp:connection host="myHost" port="22" username="myUser" password="myPassword" />
</sftp:config>

<until-successful maxRetries="1" doc:name="Until Successful"  millisBetweenRetries="30000">
            <sftp:read doc:name="Read employee file"  config-ref="SFTP_Config" path="${sftp.inputDir}\employee.unl" timeBetweenSizeCheck="-1" outputMimeType="application/csv; streaming=true; header=false; separator=|" outputEncoding="UTF-8">
                <non-repeatable-stream />
        </sftp:read>
        </until-successful>
        
        <choice doc:name="is the file empty ?"  >
            <when expression="sizeOf(payload) == 0">
                <raise-error doc:name="Raise error on empty file "  type="FILE_NOT_PRESENT_OR_EMPTY" description="Employee File empty "/>
            </when>
            <otherwise >
                <logger level="INFO" doc:name="Payload not empty"  message=" #[sizeOf(payload)]" category="employee"/>
            </otherwise>
        </choice>

So when the code enters the choice condition I can see the file is somehow no longer available on SFTP drive ...

I have tested this code in debug mode to verify when the file is getting deleted / disappearing.

Not sure why this would happen ?

why is the file getting deleted after code enters into the choice condition ?

0

There are 0 best solutions below