Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to schedule one job with multiple triggers #11

Open
ludwik opened this issue Jul 15, 2014 · 1 comment
Open

Unable to schedule one job with multiple triggers #11

ludwik opened this issue Jul 15, 2014 · 1 comment

Comments

@ludwik
Copy link

ludwik commented Jul 15, 2014

Hi.

I'd like to do something like this:

(defjob NoOpJob
  [ctx]
  (println "Does nothing"))


(defn -main
  [& m]
  (qs/initialize)
  (qs/start)
  (let [job1 (j/build
              (j/of-type NoOpJob)
              (j/with-identity (j/key "jobs.noop.1")))
        tk1      (t/key "triggers.1" "triggs1")
        tk2      (t/key "triggers.2" "triggs2")
        trigger1 (t/build
                  (t/with-identity tk1)
                  (t/start-now)
                  (t/with-schedule (schedule
                                     (with-repeat-count 10)
                                     (with-interval-in-milliseconds 2000)
                                    )))
        trigger2 (t/build
                  (t/with-identity tk2)
                  (t/start-now)
                  (t/with-schedule (schedule
                                     (with-repeat-count 16)
                                     (with-interval-in-milliseconds 1000)

                                    )))
        ]
  (qs/schedule job1 trigger1)
  (qs/schedule job1 trigger2)    ;;;This causes error
    ))

but I am getting error:

"
ObjectAlreadyExistsException Unable to store Job : 'DEFAULT.jobs.noop.1', because one already exists with this identification. org.quartz.simpl.RAMJobStore.storeJob (RAMJobStore.java:277)
"

Example here suggests it should be possible:
http://www.mkyong.com/java/example-to-run-multiple-jobs-in-quartz/

For now I'm like to fully duplicate the job to schedule 2, independent instances of the same workload.

Kind regards.

Ludwik.

@michaelklishin
Copy link
Owner

Please post full stack trace, it's impossible to tell at what step you get the exception. Please add the ns macro "header" to your code, it's not clear what schedule qs may be referring to.

Finally, there is quartzite.scheduler/maybe-schedule and quartzite.scheduler/add-trigger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants