Results 1 to 2 of 2

Thread: Self-scheduling Quartz jobs

  1. #1
    Join Date
    Aug 2004
    Location
    Atlanta, GA
    Posts
    129

    Default Self-scheduling Quartz jobs

    I've looked through the Spring and Quartz documentation, but can't see the solution.

    I'm running in a Websphere 5.0.2 environment and I have a need for a job (call it UberJob) that runs every 8 hours looking for missing parts from orders. For any parts that it finds, I want to run concurrent jobs (ConcurrentJob) for each part that searches the vendors.

    From what I've read, UberJob can get a (partially set-up) prototype ConcurrentJob from the applicationContext by exposing an applicationContext property. UberJob can then tell ConcurrentJob what part number to look for, but what would be the best way to get a handle to the scheduler so I can trigger it?
    Simply get the scheduler from the factory through the appContext?
    Is there a property I can create where it will be provided (i.e. setScheduler)?
    Or should I wire the scheduler factory to UberJob in the context XML? I noticed in the reference doc your example doesn't have an id or name set on the factory (to discourage this misuse probably).

    Thanks in advance for any help.

  2. #2
    Join Date
    Aug 2004
    Location
    Montreal - Canada
    Posts
    46

    Default

    Simply use context.getScheduler() in your Job:

    Code:
    public class MyJob implements Job {  
      /**
       * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
       */
      public void execute(JobExecutionContext context) throws JobExecutionException {
        Scheduler scheduler =  context.getScheduler();
        ...
    }
    Christophe

Similar Threads

  1. Replies: 3
    Last Post: May 4th, 2010, 03:23 AM
  2. Scheduling Jobs with Quartz and Spring
    By MmarcoM in forum Container
    Replies: 4
    Last Post: Mar 2nd, 2010, 02:23 PM
  3. Problem with Quartz and Spring (durable jobs)
    By keithc in forum Container
    Replies: 4
    Last Post: Nov 1st, 2006, 02:17 PM
  4. Replies: 1
    Last Post: May 15th, 2005, 06:37 AM
  5. Scheduling Quartz jobs and Application Context
    By fmourioux in forum Container
    Replies: 5
    Last Post: Aug 27th, 2004, 01:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •