20 Jul 2018 - jbo

Apache Karaf has a scheduler, allowing you to periodically execute actions. It’s powered by Quartz and provide several convenient features.

Apache Karaf has a scheduler, allowing you to periodically execute actions. It’s powered by Quartz and provide several convenient features.

You can easily install the scheduler with the scheduler feature: 1

karaf@root> feature:install scheduler

Once you have installed the scheduler, you have new commands available: scheduler:schedule, scheduler:list, etc.

The Karaf scheduler also provides a whiteboard pattern to looking for Runnable or Job. It uses the service properties as configuration of the scheduling.

It’s what Karaf Decanter uses for the polled collector, like the JMX collector for instance: the Karaf scheduler execute the run() method of the JMX collector every minute by default. You can “reschedule” a job using the scheduler:reschedule command.