Timer Component
The timer: component provides timed events to Bean component. is used to generate message exchanges when a timer fires You can only consume events from this endpoint. It produces BeanExchanges that send a Runnable. run() method invocation.
URI format
Code Block |
---|
timer:name?options |
...
Name | Default Value | Description |
---|---|---|
name | 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 then only one Timer object & thread will be used | |
time |
| The date/time that the (first) event should be generated. |
period | -1 | If set to greater than 0, then generate periodic events every period milliseconds |
delay | -1 | The number of milliseconds to wait before the first event is generated. Should not be used in conjunction with the time parameter. |
fixedRate | false | Events take place at approximately regular intervals, separated by the specified period. |
daemon | true | Should the thread associated with the timer endpoint be run as a daemon. |
...
Code Block | ||||
---|---|---|---|---|
| ||||
from("timer://foo?fixedRate=true&delay=0&period=500").to("pojo:barbean:myBean?methodName=someMethodName"); |
Note that the "bar" pojo registered should implement RunnableThe above route will generate an event then invoke the someMethodName on the bean called myBean in the Registry such as JNDI or Spring.
Include Page | ||||
---|---|---|---|---|
|