You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kanmisc <ka...@gmail.com> on 2010/12/28 15:55:46 UTC

Consuming Files using Timer/Quartz

Hi, We have route as below. The files from data/temp need to be send to smtp
server every 5 mins. But this is not happening here. Is anything missed in
the route here? I have read few threads related to this but no luck.

from("quartz://myTimer?trigger.repeatInterval=300000&trigger.repeatCount=-1").
from("file:data/temp?noop=true").
 when(header("CamelFileName").isEqualTo("template1.html")).
 setHeader("Message-ID",constant("<SE...@yy>")).
 to("smtp://localhost:9819?to="myEmailID").
 bean(FileValidator.class, "processFiles").

when(header("CamelFileName").isEqualTo("template2.html")).
 setHeader("Message-ID",constant("<SE...@yy>")).
 to("smtp://localhost:9819?to="myEmailID").
 bean(FileValidator.class, "processFiles");

Thanks in advance.

-- 
View this message in context: http://camel.465427.n5.nabble.com/Consuming-Files-using-Timer-Quartz-tp3320330p3320330.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Consuming Files using Timer/Quartz

Posted by kanmisc <ka...@gmail.com>.
Thanks Christian. It worked well with Consumer and Producer Templates.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Consuming-Files-using-Timer-Quartz-tp3320330p3331784.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Consuming Files using Timer/Quartz

Posted by Christian Müller <ch...@gmail.com>.
from("xxx").from("yyy") is not valid.

See the configuration options for the camel-file [1] if the directory should
be polled for every 5 minutes. Look for the the "delay" option and maybe
also the "initialDelay" option.

If you want to send the same file every 5 minutes (for whatever reason), use
the camel-quartz [2] component to trigger a processor which use a consumer
template to consume the file. See the Camel in Action book [3] for details
(site 481 chapter C.2.1).
This is not an elegant way and will be improved in Camel 3 [4] (look for
schedule DSL)

[1] http://camel.apache.org/file2.html
[2] http://camel.apache.org/quartz.html
[3] http://www.manning.com/ibsen/
[4] https://cwiki.apache.org/confluence/display/CAMEL/Camel+3.0+-+Roadmap

Cheers,
Christian