Palani
Palani

Reputation: 1921

Mule file transfer not deleting source files

I am using Mule 3.2 and I am moving files from one location to another location. The error/problem is that Mule keeps on processing the same files again and again and do not deleted them.

The console displays:

org.mule.transport.file.FileMessageReceiver: Lock obtained on file:

My config file is below:

<flow name="File-FTP-Bridge">
    <file:inbound-endpoint path="${outbound.input.path}"
        moveToDirectory="${outbound.input.backup.path}">
        <file:filename-wildcard-filter
            pattern="*.msg" />
    </file:inbound-endpoint>
    <ftp:outbound-endpoint user="${outbound.ftp.user}"
        password="${outbound.ftp.password}" host="${outbound.ftp.host}"
        path="${outbound.ftp.path}" port="${outbound.ftp.port}"
        outputPattern="#[header:originalFilename]">
    </ftp:outbound-endpoint>
</flow>

I could not find the root cause for this problem. Thanks in advance.

Upvotes: 5

Views: 6217

Answers (1)

David Dossot
David Dossot

Reputation: 33413

Your file endpoint misses a pollingFrequency attributes, which means it uses the default of 1000ms. This makes Mule poll files way faster than the FTP endpoint can process them. Try for example:

pollingFrequency="10000"

If this is not good enough because the FTP upload has unpredictable performances (so Mule still retries a file that is being uploaded), then if your files are small enough to fit in memory, try adding:

<object-to-byte-array-transformer />

between your inbound and outbound endpoint. This loads the file in-memory and moves it right away to outbound.input.backup.path, before trying the FTP upload. Of course, if the FTP upload fails, you'll have to move the file back to outbound.input.path...

Upvotes: 3

Related Questions