camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: Camel Java routes using Timer firing only once
Date Sat, 26 Jul 2014 01:04:23 GMT
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 []
Sent: Friday, July 25, 2014 11:38 PM
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:
Sent from the Camel - Users mailing list archive at
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.

View raw message