I have created a scheduler which looks for the assets that are expiring in upcoming 5 days and then it triggers an email to the owner of the asset to provide update about its expiration.
Issue in the service is that scheduler is getting activated twice and as it runs twice so email is also triggered twice to the owner of the asset.
I checked about it and found that it may occur if there is a cluster of AEM instance as the scheduler will be running on all instances, so I used the onSingleInstanceOnly(java.lang.String slingIds) method to register the scheduler only once. It worked after this change but now after few days again I am receiving the email twice. In the logs again I can see that scheduler is getting registered twice.
Please suggest any solution about it.
Solved! Go to Solution.
yes i have tried this.
@Property (name="scheduler.runOn", value="SINGLE")
is similar to
here is the URL of Page where the method details are mentioned. maybe I can try changing it and use it the way you are saying.
@Dipti_Chauhan , I'm also facing the same issue.
I have a query. If we are having multiple instances running with in the cluster, When we set the above mentioned property will the scheduler executed on other instances or not.
If not how the changes will be reflected on other instances. Please confirm.
Hey, I had to convert it to a Sling Scheduler Job from Sling Commons scheduler service to make it work acc. to adobe recommendations.