AEM cronjob based on details present under content node certain time | Community
Skip to main content
srinivas_chann1
Level 7
September 7, 2022
Solved

AEM cronjob based on details present under content node certain time

  • September 7, 2022
  • 1 reply
  • 1191 views

Hello,

 

I have come across where we have cronjob with OSGI configurations written for the cron expression.

https://sling.apache.org/documentation/bundles/scheduler-service-commons-scheduler.html#scheduling-with-a-cron-expression-1

 

Instead of getting the time stamp from OSGI , I would want to get the time stamp stored  under /content/abc node property.

 

How could this be achieved that cronjob can trigger based on the time stamp stored under /content/abc

 

Could some one please provide inputs as how could this be done

 

Regards,

Srinivas

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Nitin_laad

@srinivas_chann1 

The following two approaches will help you reach the given ask: 

1.  Create an event lister which will be invoked when the node property changes/updates
Alternatively
2. , create another cron job that reads the values/timestamps given in node properties, and based on those values, invokes another cron job which performs the task. 

1 reply

Nitin_laad
Community Advisor
Nitin_laadCommunity AdvisorAccepted solution
Community Advisor
September 7, 2022

@srinivas_chann1 

The following two approaches will help you reach the given ask: 

1.  Create an event lister which will be invoked when the node property changes/updates
Alternatively
2. , create another cron job that reads the values/timestamps given in node properties, and based on those values, invokes another cron job which performs the task. 
arunpatidar
Community Advisor
Community Advisor
September 8, 2022

HI @srinivas_chann1 

If you are looking for how to change osgi configuration based on node update and when service is activated, check the sample logic at below

https://github.com/arunpatidar02/aemaacs-aemlab/blob/master/core/src/main/java/com/community/aemlab/core/servlets/sample/SetSingletonConfigServlet.java 

 

You can also set default value in OCD reading from node, make sure the service ranking in a desire order

Arun Patidar
srinivas_chann1
Level 7
September 8, 2022

Thanks to @arunpatidar  and @nitin_laad  both the inputs helped to solve this issue