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
>

Reply via email to