How to Add Scheduling Events in CQ

Scheduling in CQ can be done pretty easily. CQ uses sling scheduling which further uses open source Quartz schedulers. Often developers who are new to Scheduling want to write a scheduler expression that should trigger at the right time. I also sometimes look for documentation for writing expression. But recently i found a website CronMaker that can help you in identifying the right cron expression to add to your classes.

Scheduling works in two ways in CQ

1) By registering the job through the scheduler API.
2) By leveraging the whiteboard pattern that is supported by the scheduler. (Easy to implement but cannot be scaled).

Scheduling documentation can be found at this link. This pretty much self explains how you can write your custom schedulers and expression can be created from CronMaker website easily. The documentation explains both the approaches listed above in self explanatory way and you don’t have to look anywhere else.

The documentation is bit old and should user newer Annotations, but those can be simply added. If you are creating scheduled events you should configure properties in Felix console and should accept the values in activate method and configure your expressions w.r.t parameters received.


One thought on “How to Add Scheduling Events in CQ

  1. Hi,

    I have a Sling servlet code that is returning me some mbean information.
    However, I would want to schedule it using sling scheduler.
    Can you please let me know, as to how this could be done.
    I am struggling to get this to work.

    Any thoughts/pointers/code would be really helpful.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s