That is because the expression builder evaluates string to actual values during 
route definition.

If you use the following syntax you will get new time for every timer run.

from("timer://foo?fixedRate=true&period=1000").transform(simple("Time is 
${date:now:HH:mm:ss}")).to("file:target/reports/?fileName=sync.txt");

________________________________________
From: mikes300 [[email protected]]
Sent: Friday, July 25, 2014 11:38 PM
To: [email protected]
Subject: RE: Camel Java routes using Timer firing only once

Well that turns out to be very interesting.  Setting the timer to 1s and
sleep to 30s, it indeed runs the route 30 times!  I am not sure I could
explain why it does that as I would think the route starting would include
running the timer continually, independent of code in the bean outside the
route itself.

Also interesting is that it uses the same Date() object for each iteration
of the route, even though the message (or at least the messageID) changes.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Java-routes-using-Timer-firing-only-once-tp5754275p5754458.html
Sent from the Camel - Users mailing list archive at Nabble.com.
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.

Reply via email to