Body of timer is null hence it will fail on the first message.

Try following and it will work as expected. You can use timer without spring.

                
from("timer://foo?fixedRate=true&period=1000").setBody(body().append("Time is " 
+ new Date())).to("file:target/reports/?fileName=sync.txt");

-Ravi
________________________________________
From: mikes300 [[email protected]]
Sent: Wednesday, July 23, 2014 9:03 AM
To: [email protected]
Subject: Camel Java routes using Timer firing only once

I can get routes kicked off in Java DSL however the timer routes execute once
and only once no matter what.  Here is a sample of what I have, very
easy/simple.  But it just fires once.  Successfully, but just once.

from("timer://foo?fixedRate=true&period=10000").to("file:target/reports/?fileName=sync.txt");
//                      from("timer://foo?fixedRate=true&period=10s").bean(new
SyncInvoker(), "sayHello()");
//                      from("timer://foo?fixedRate=true&period=10s").bean(new
SyncInvoker(), "sayHello()");

I can get it to work in Spring after it bootstraps its listener context but
then I am stuck in Spring and we have a requirement to get out of Spring.
Any thoughts out there?  Or examples of a full route config in java that
utilizes a timer as such?

In the end I am using it to manage a polling mechanism against some ActiveMQ
queues, then doing stuff with the messages.  But I am stuck at step one!

Thanks in advance!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Java-routes-using-Timer-firing-only-once-tp5754275.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