Expand my Community achievements bar.

SOLVED

AEM cronjob based on details present under content node certain time

Avatar

Level 8

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

 

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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

Avatar

Community Advisor

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

 

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



Arun Patidar

Avatar

Level 8

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