Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Stop / close the scheduler

Avatar

Avatar
Validate 10
Level 3
_SumitSinghal
Level 3

Likes

5 likes

Total Posts

79 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
_SumitSinghal
Level 3

Likes

5 likes

Total Posts

79 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
_SumitSinghal
Level 3

07-12-2015

Hi,

Please help me how to stop the scheduler in AEM6. 

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,130 likes

Total Posts

6,151 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,130 likes

Total Posts

6,151 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

07-12-2015

Hi 

Please refer to the article mentioned below to help you out.

Link:- http://hashimkhan.in/aem-adobecq5-code-templates/scheduler/

//

Option 1:- We can have periodic Scheduling by using longValue = x, the job will execute every X seconds, so if you want to stop for some while, you can specify this x accordingly.

Option 2: API based, 

Scheduling with a cron expression

To execute the job as defined above at 10:15am every Monday, Tuesday, Wednesday, Thursday and Friday, you can use the addJob() method with the following parameters:

String schedulingExpression = "0 15 10 ? * MON-FRI";this.scheduler.addJob("myJob", job, null, schedulingExpression, true);

Option 3:

Scheduling at periodic times

To execute the job as defined above every 3 minutes (180 seconds), you can use the addPeriodicJob() method with the following parameters:

long period = 3*60; //the period is expressed in secondsthis.scheduler.addPeriodicJob("myJob", job, null, period, true);

 

Option 4:

Scheduling at a given time

To execute the job as defined above at a specific date (on January 10th 2020), you can use the fireJobAt() method with the following parameters:

SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");String date = "2020/01/10";java.util.Date fireDate = formatter.parse(date);this.scheduler.fireJobAt("myJob", job, null, fireDate);

 

And you can otherwise stop the service (deactivate it).

Some reference articles are :- https://helpx.adobe.com/experience-manager/using/aem-first-components1.htmlhttps://sling.apache.org/documentation/bundles/scheduler-service-commons-scheduler.html

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Answers (1)

Answers (1)

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,130 likes

Total Posts

6,151 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,130 likes

Total Posts

6,151 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

07-12-2015

Hi 

This is a DTM forum. I would request you to post question for AEM on AEM forum Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

Thanks and Regards

Kautuk Sahni