Montag, 3. Juni 2013

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 ... } }

Keine Kommentare:

Kommentar veröffentlichen