Scheduled Service in CQ5

Cron or Quartz like behaviour in CQ5 comes out of the box. See more examples. I have seen the annotation as comments, which I think is a bad style.

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.slf4j.Logger; import org.slf4j.LoggerFactory;

@Component @Service @Property(name=“scheduler.expression”, value = “0 * * * * ?“) public class ScheduledJob implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(ScheduledJob.class);

public void run() {
// your code goes here …
} }


cq5

75 Words

2013-06-03 08:35 +0000