Add some logging statements to figure out what the actual values are... Best, Christian -----------------
Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Tue, Jul 30, 2013 at 5:10 PM, Karim Garza <karimga...@gmail.com> wrote: > Thank you for your reply. I tried using the EIP filter and I could not get > it to work even after comparing milliseconds to milliseconds. > > I then tried Christian's suggestion and it work as expected. My route ended > up as > @Override > public void configure() throws Exception { > from("file:{{file.inbox}}?delete=true&filter=#FilterOldFiles") > .process(new FileProcessor()); > } > > and the class FilterOldFiles as > public class FilterOldFiles<T> implements GenericFileFilter<T> { > public boolean accept(GenericFile<T> file) { > DateTime date = new DateTime(); > if(date.minusDays(30).getMillis() > file.getLastModified()) > return true; > return false; > } > } > > Thank you both for you help > > > > > On Mon, Jul 29, 2013 at 5:11 PM, Christian Müller < > christian.muel...@gmail.com> wrote: > > > Use the file component option "filter" [1], not the filter EIP. > > Implement the org.apache.camel.component.file.GenericFileFilter class. > > Create a new Calendar instance, subtract 30 days and take the time in > > millis. If it's higher than the "CamelFileLastModified" header value, > > return true. Otherwise, return false. > > > > [1] http://camel.apache.org/file2.html > > > > Best, > > Christian > > ----------------- > > > > Software Integration Specialist > > > > Apache Camel committer: https://camel.apache.org/team > > V.P. Apache Camel: https://www.apache.org/foundation/ > > Apache Member: https://www.apache.org/foundation/members.html > > > > https://www.linkedin.com/pub/christian-mueller/11/551/642 > > > > > > On Mon, Jul 29, 2013 at 10:45 PM, Karim Garza <karimga...@gmail.com> > > wrote: > > > > > Hi, > > > > > > I am trying to use the MessageFilter to process files that are 30 days > or > > > older. I came up with this code to do the work, but it appears that > > > the CamelFileLastModified header is a long and I do not know how to use > > to > > > compare it with a date. > > > > > > public void configure() throws Exception { > > > DateTime date = new DateTime(); > > > from("file:{{file.inbox}}?delete=true") > > > .filter(header("CamelFileLastModified").isLessThan(date.minusDays(30))) > > > .process(new FileProcessor()); > > > } > > > > > > I would appreciate any help you can provide, > > > > > > Karim > > > > > >