i want to read FTP file using apache camel -


i want read ftp file using apache camel requirement pick files around 4-5 files , process them question how can pick files specific date example want pick file created today leave yesterday file.

how can write code pick files ftp using apache camel filtration on dates

you can implement custom filter , ask camel process files satisfy filter

eg:

public class datefilter<t> implements genericfilefilter<t> {     public boolean accept(genericfile<t> file) {         calendar c = calendar.getinstance();         c.set(calendar.hour_of_day, 0);         c.set(calendar.minute, 0);         c.set(calendar.second, 0);         c.set(calendar.millisecond, 0);         long todayinmillis = c.gettimeinmillis();         return file.getlastmodified() >= todayinmillis;     } } 

define filefilter bean

<bean id="datefilter" class="com.something.datefilter"/> 

use above filter in route

from("ftp://someuser@someftpserver.com?password=secret&amp;filter=#datefilter")    .to("somedestination") 

documentation here


Comments

Popular posts from this blog

c# SetCompatibleTextRenderingDefault must be called before the first -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -

c++ - Fill runtime data at compile time with templates -