Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-3701

[Job Scheduling] : No API to search through the scheduled jobs based on some properties.

    XMLWordPrintableJSON

Details

    Description

      JobManager has the following API to search for jobs of jcr:primaryType as "slingevent:Job":
      Job getJob(String topic, Map<String, Object> template);
      Collection<Job> findJobs(QueryType type, String topic, long limit, Map<String, Object>... templates);

      However, I am unable to find an API that will help me search through the scheduled jobs that are of jcr:primaryType as "slingevent:TimedEvent" and are scheduled to become slingevent:Job at a specific time in future.

      Issue:
      Since the above mentioned APIs do not return the scheduled jobs, we are left with the option of retrieving ALL the scheduled jobs using
      jobManager.getScheduledJobs();
      and then iterating through each of these jobs to find a particular desired job.

      Requirement:
      An API providing search on scheduled jobs based on the event topic and properties would be good. This is required to check if a replication job already exists for a asset and if it does, it needs to be rescheduled.

      Workaround:
      Collection<ScheduledJobInfo> scheduledJobs = jobManager.getScheduledJobs();
      for (ScheduledJobInfo eachJob : scheduledJobs)

      { if (criteria matches with eachJob) { eachJob.reschedule(); }

      }

      Attachments

        Activity

          People

            cziegeler Carsten Ziegeler
            anshika Anshika Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: