简体   繁体   中英

Mule 3 CE - File Processing Order

Good morning to everybody, I have a problem using Mule ESB CE with file order. In the mule flow I have a File Inbound Endpoint that triggers the flow when one or more files come into a specified directory.

Let's assume that i have three files (a.txt,b.txt,c.txt), and I'd like to process b.txt first then a.txt and finally, c.txt.

How can I do that?

I read something about "File Processing Order" comparator that allows to write an own custom comparator but i did not find any example (neither in the Mule documentation).

Could anyone explain how to write a simple "file comparator" that order those files as above?

Thanks in advance. Best Regards PL

Just implement a custom comparator, and declare your file endpoint like this:

<file:inbound-endpoint connector-ref="fileConnector"
       path="${path}" 
       moveToDirectory="${move.path}"
       moveToPattern="#[message.inboundProperties['originalFilename']]" 
       comparator="your.package.comparators.YourComparator"
/> 

Note that I've had some classloading problems using custom comparators with file endpoints(at least on 3.3.1 CE), notably this bug .

Let's assume that i have three files (a.txt,b.txt,c.txt), and I'd like to process b.txt first then a.txt and finally, c.txt.

How can I do that?

As for the actual ordering, you need to use some collation to decide the order. This may be simple, or very complicated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM