Use Case:
1) You want to implement a scheduler to run on a specific event. That event could be any thing ranging from any Node action (Add,Modify,Delete) or any replication action (Activate, Deactivate, Reverse)
Pre requisite:
1) http://sling.apache.org/site/eventing-and-jobs.html
2) http://felix.apache.org/site/apache-felix-event-admin.html
3) http://www.osgi.org/javadoc/r4v41/org/osgi/service/event/package-summary.html
4) http://sling.apache.org/apidocs/sling5/org/apache/sling/event/package-summary.html
Implementation:
Step 1
Step 2: Handler to perform action
Note: you can find some more code example at http://wemcode.wemblog.com
1) You want to implement a scheduler to run on a specific event. That event could be any thing ranging from any Node action (Add,Modify,Delete) or any replication action (Activate, Deactivate, Reverse)
Pre requisite:
1) http://sling.apache.org/site/eventing-and-jobs.html
2) http://felix.apache.org/site/apache-felix-event-admin.html
3) http://www.osgi.org/javadoc/r4v41/org/osgi/service/event/package-summary.html
4) http://sling.apache.org/apidocs/sling5/org/apache/sling/event/package-summary.html
Implementation:
Step 1
Step 2: Handler to perform action
Note: you can find some more code example at http://wemcode.wemblog.com
It worked! Thanks for the code, I would not be able to do this on my own. I am amazed on how you did this hard coded. I always wanted to be a programmer and I had spent time on reviewing but I guess its either you have it or you don't.
ReplyDeleteClear codes and looks professional. Hopefully this is easy to implement.
ReplyDeletethis is not look like scheduler but i found good implementation of event handler
ReplyDeleteScheduler is getting generated at run time here using this.scheduler.fireJobAt(path, eventJob, props, endDate);
DeleteYou can find better example of normal scheduler (Independent of event) from here http://wemcode.wemblog.com/invlidate_cache
Yogesh
Hi Yogesh,
ReplyDeleteIs there any console/way to check the scheduled jobs queue in CQ 5.5? We are removing the scheduled jobs using scheduler.removeJob("JobName") , but we want to make sure the jobs are indeed getting removed.
Thanks
Kundan,
DeleteYou can see all scheduled Job under HOST:PORT/system/console/status-slingscheduler
Yogesh
Hi Yogesh,
DeleteI 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.