user3663479
user3663479

Reputation: 11

File endpoint in MULE

How to use Move to Pattern & File Age property of File EndPoint in MULE.

I tried to give moveToPattern="#[function:datestamp]-#[message.inboundProperties['originalFilename']]" but it is not working as expected.

For File Age, I provided 50000. According to my understanding, if the last modified date of the file is 22.01.2015:20:07:20, then the file should be moved from this folder to another folder at 22.01.2015:20:12:20. But it is not happening. Please explain by giving an example.

What is the difference between connector reference & endpoint reference.

Upvotes: 0

Views: 535

Answers (2)

David Dossot
David Dossot

Reputation: 33413

The documentation for fileAge in the file transport reference is:

Setting this value (minimum age in milliseconds for a file to be processed) is useful when consuming large files, as Mule waits before reading this file until the file last modification timestamp indicates that the file is older than this value

In your case 50000 milliseconds would be 50 seconds, thus a file dropped at 22.01.2015:20:07:20 should be picked as soon as 22.01.2015:20:08:10.

Since it is not happening, there must be something wrong in your configuration. Please share your file transport configuration (if any) and your full endpoint configuration.

Upvotes: 0

clare
clare

Reputation: 526

The 'file age' property defines the time a file must wait before it's processed. Once it's processed, it is going to move to the directory specified in the 'moveToDirectory'.

The file connector is a global connector where you can specify some properties that can be applied to all of your file endpoint configuration.

<file:connector name="File" autoDelete="true"
    outputAppend="true" streaming="true" validateConnections="true"
    doc:name="File" />

A file endpoint is a generic endpoint that can be referred from all your endpoints. For example, you have different endpoints with the same configuration, thus you can specify all the properties on a global endpoint, so when you need to change something, you only change the global one.

<file:endpoint name="fileEndpoint"
    path="${file.path}" outputPattern="${file.outputPattern}" moveToDirectory="${file.moveToDir}"
    connector-ref="File" doc:name="File" fileAge="5000"/>

The file inbound/outbound endpoints can then refer the global endpoints.

<file:outbound-endpoint responseTimeout="10000"
            ref="fileEndpoint" doc:name="File - Log" /> 

Upvotes: 1

Related Questions