APIs to retrieve the scheduled jobs | Community
Skip to main content
New Participant
Dec 15, 2020 3:40 PM UTC
Solved

APIs to retrieve the scheduled jobs

Hello All,

We need to provide an option from UI for the business to manage the scheduled jobs.
Users should be able to see the scheduled jobs, reschedule, and cancel the jobs.

I am using the Scheduler class to schedule the jobs.

ScheduleOptions options = scheduler.EXPR("0 55 16 * * ?");
options.canRunConcurrently(false);
options.name("Test Job");
final Runnable job3 = new Runnable() {
@9944223
public void run() {
LOGGER.debug("Executing Test Job");
pullPR();
}
};

this.scheduler.schedule(job3,options);

I am looking for APIs to retrieve the scheduled jobs and manage them. Any help would be much appreciated.

Thank you!!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Peter_Puzanovs
Peter_PuzanovsAccepted solution
New Participant
Dec 16, 2020 9:36 AM UTC

Hi Kasiv,

 

The API is not exposed, so we have to use workaround to get these details. In ideal universe we would always know the names of our jobs.

 

One Options is to:

Write code to get the list of scheduled jobs from the output of the Apache Sling Scheduler Configuration Printer parse it and get a list of jobs.

Another Option is to:

Create your CustomerSchedulerWrapper where you would save all the jobs you created in a data structure that fits your needs and manage jobs appropriately.

 

Via both options you can use the standard API's available in Scheduler to start/stop/reschedule jobs.

 

Regards,

Peter

2 replies

Peter_Puzanovs
Peter_PuzanovsAccepted solution
New Participant
Dec 16, 2020 9:36 AM UTC

Hi Kasiv,

 

The API is not exposed, so we have to use workaround to get these details. In ideal universe we would always know the names of our jobs.

 

One Options is to:

Write code to get the list of scheduled jobs from the output of the Apache Sling Scheduler Configuration Printer parse it and get a list of jobs.

Another Option is to:

Create your CustomerSchedulerWrapper where you would save all the jobs you created in a data structure that fits your needs and manage jobs appropriately.

 

Via both options you can use the standard API's available in Scheduler to start/stop/reschedule jobs.

 

Regards,

Peter

Translate
kautuk_sahni
Employee
Jan 8, 2021 10:54 AM UTC
It is always a pleasure to read your answers. Keep helping others here.
Translate
Kautuk Sahni