I have configured a scheduler in AEM6.5 and the idea is that it runs ONCE a night at 2AM
@Designate(ocd = TagVerificationScheduledTask.Config.class)
@Component(service = {Runnable.class})
public class TagVerificationScheduledTask implements Runnable {
@ObjectClassDefinition(name = "scheduled task that verifies tags in blog articles",
description = "A scheduled task that verifies tags in blog articles")
public @interface Config {
@AttributeDefinition(name = "Cron-job expression. Default: run every night at 2:00 AM.")
String scheduler_expression() default "0 0 2 * * ?";
The job runs on all three instances (one author and two publishers) and I want it to run on only one instance i.E. author.
How can I configure that?
O tried @Property(name="scheduler.runOn", value="SINGLE"); but it does not work. I also tried @AttributeDefinition(name = "Run On") String scheduler_runOn() default "SINGLE"; but that also did not work.
Solved! Go to Solution.
Views
Replies
Total Likes
The scheduler runs independently on each AEM instance; they don't know of each other (except for the replication, but that's a different story). That means every instance thinks of itself as a SINGLE instance, which at the same time is also a Cluster LEADER.
That means in your setup you implement this at best on the author only (make this service only running on author using OSGI configuration, see https://cqdump.joerghoh.de/2019/10/14/how-to-use-runmodes-correctly/)
Hi @anasustic,
I guess that you have multiple author and publish instances where the scheduler is running, possibly three instances in your case. This is why the email is sent three times at 2 AM.
Thanks a lot for your reply.
I have one Author and two Publish instances.
Is there a way to configure the job to run only once and only on one instance?
Please check the discussion here
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-cloud-is-scheduler-run...
Regards,
Divanshu
Hi @divanshug
Thanks a lot for your reply. I am not sure how to configure it to run only on one node (i.E. author instance) using the documentation you provided:
@Property(name="scheduler.runOn", value="LEADER");
or
@Property(name="scheduler.runOn", value="SINGLE");
The scheduler runs independently on each AEM instance; they don't know of each other (except for the replication, but that's a different story). That means every instance thinks of itself as a SINGLE instance, which at the same time is also a Cluster LEADER.
That means in your setup you implement this at best on the author only (make this service only running on author using OSGI configuration, see https://cqdump.joerghoh.de/2019/10/14/how-to-use-runmodes-correctly/)
Views
Likes
Replies