And btw since you use java dsl, then its all java code and you can use
string concat / string format to put in the ugly number from a
variable or use Camel's property placeholders

On Wed, Oct 7, 2020 at 7:05 AM Claus Ibsen <[email protected]> wrote:
>
> Hi
>
> You cannot do that, the function only supports hours.
>
> 1 month is also not a fixed value, e.g. each month varies in days.
>
>
>
> On Tue, Oct 6, 2020 at 2:23 PM Daniel Johansson <[email protected]> wrote:
> >
> > Hi Users
> >
> > When i use the file component i want to filter on files that are older then
> > one month and only process those files.
> >
> > I have been experimenting with:
> > filterFile=$simple{file:modified} < ${date:now}
> > and:
> > .filter(header("CamelFileLastModified").isLessThan("${date:now} -
> > $simple{header.ONE_MONTH}"))
> >
> > what i would like to do is to offset ${date:now} with one month like
> >
> > "${date:now-${header.ONE_MONTH}}"
> >
> > The documentation for simple language for 'date:' variable says:
> > "Command accepts offsets such as: *now-24h* or *in.header.xxx+1h* or even
> > *now+1h30m-100*."
> > https://camel.apache.org/components/2.x/languages/simple-language.html
> >
> > I have the constant ONE_MONTH with
> > private final long ONE_MONTH = 2592000000L;
> > and set the header with:
> > .setHeader("ONE_MONTH", constant(ONE_MONTH))
> >
> > the only way i got it to work is with.
> >
> > from("file:historyfolder?delete=true&filterFile=$simple{file:modified} <
> > ${date:now - 2592000000}")
> >   .routeId("'remove old handled files'")
> >   .log("File is deleted: " + "file name: " + "${file:name}" + "
> > lastmodified: " + "${date:file:yyyy-MM-dd HH:mm:ss}");
> >
> > But I want to get rid of that ugly long value and offset it with a constant
> > from a header or something similar instead.
> >
> > How can I do this?
> >
> > All the best!
> >
> > /Daniel
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to