Timer ComponentThe timer: component is used to generate message exchanges when a timer fires You can only consume events from this endpoint. URI formattimer:name[?options] Where name is the name of the Timer object, which is created and shared across endpoints. So if you use the same name for all your timer endpoints, only one Timer object and thread will be used. You can append query options to the URI in the following format, ?option=value&option=value&... Note: The IN body of the generated exchange is null. So exchange.getIn().getBody() returns null.
Options
Exchange PropertiesWhen the timer is fired, it adds the following information as properties to the Exchange:
Message HeadersWhen the timer is fired, it adds the following information as headers to the IN message
SampleTo set up a route that generates an event every 60 seconds:
from("timer://foo?fixedRate=true&period=60000").to("bean:myBean?method=someMethodName");
The above route will generate an event and then invoke the someMethodName method on the bean called myBean in the Registry such as JNDI or Spring. And the route in Spring DSL: <route> <from uri="timer://foo?fixedRate=true&period=60000"/> <to uri="bean:myBean?method=someMethodName"/> </route> See Also |