I am using quartzite
, and I need to schedule a job every tuesday morning (say at 10 AM).
I have the code for the job, but I'm not sure how to schedule it.
Should I use the
daily
or thecalendar
schedulers ?Should I use
with-interval-in-days
(how) ?
Edit : Here is what I have so far, but it doesn't work (see comment).
(defn start-weekly-email-job []
(let [job (job/build
(job/of-type AlertMail)
(job/with-identity (job/key "jobs.weekly.1")))
trigger (trigger/build
(trigger/with-identity (trigger/key "triggers.1"))
(trigger/start-at (time-of-day 10 00 00))
; at 10 AM, fails with exception
; IllegalArgumentException No implementation of method: :to-date of protocol: #'clojurewerkz.quartzite.conversion/DateConversion found for class: org.quartz.TimeOfDay clojure.core/-cache-protocol-fn (core_deftype.clj:554)
(trigger/with-schedule (daily/schedule
(daily/on-days-of-the-week #{(int 2)}))))] ;; ;; start Tuesday
(qs/schedule s job trigger)))
Edit2 :
Using daily interval schedules Daily interval schedules make it easy to define schedules like
- "Monday through Friday from 9 to 17"
- "Every weekend at 3 in the morning"
- "Every Friday at noon"
- "Every day at 13:45"
- "Every hour on Thursdays but not later than 15:00, up to 400 times total"
My case is very similar from the case highlighted in the documentation, yet I can't find how to do it with the daily schedules.