You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Timer Component

The timer: component derives from the POJO component to provide timed events. You can only consume events from this endpoint. It produces POJO exchanges that send a Runnable.run() method invocation.

URI format

timer:name?options

Where options is a query string that can specify any of the following parameters:

Name

Default Value

Description

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.

Using

To setup a route that generates an event every 500 seconds:

   from("timer://foo?fixedRate=true&delay=0&period=500").to("pojo:bar");

Note that the "bar" pojo registered should implement Runnable.

  • No labels