Skip to content

Instantly share code, notes, and snippets.

@AlBaker
Created December 26, 2014 15:34
Show Gist options
  • Save AlBaker/fd1d89e3d9bd57328abe to your computer and use it in GitHub Desktop.
Save AlBaker/fd1d89e3d9bd57328abe to your computer and use it in GitHub Desktop.
(ns testjobs
(:require [clojurewerkz.quartzite.scheduler :as qs]
[clojurewerkz.quartzite.jobs :as j]
[clojurewerkz.quartzite.triggers :as t]
[clojurewerkz.quartzite.conversion :as qc]
[clojurewerkz.quartzite.schedule.simple :refer [schedule with-repeat-count with-interval-in-milliseconds]]))
(j/defjob TestJob
[ctx]
(let [d (qc/from-job-data ctx)]
(println (str "Here's my payload:" d) )))
(defn run-job []
(qs/initialize)
(qs/start)
(let [job (j/build
(j/of-type TestJob)
(j/using-job-data {"jack" "in the box"})
(j/with-identity (j/key "bananas")))
tk (t/key "triggers.2")
trigger (t/build
(t/with-identity tk)
(t/start-now)
(t/with-schedule (schedule
(with-repeat-count 100)
(with-interval-in-milliseconds 2000))))]
(qs/schedule job trigger)
tk))
@AlBaker
Copy link
Author

AlBaker commented Dec 26, 2014

Cursive Clojure arity 1 warning on lines 18, 19, 20, 26, and 27.

@cursive-ghost
Copy link

Ok, so it looks like t/build is some sort of threading form, is that right?

@cursive-ghost
Copy link

I had a look at the code. The problem is that t/build is a threading form, but the implicit parameter is hidden by the macro; see here. This will be tricky to support unfortunately, since the parameter doesn't appear anywhere in the source code. I can't think of a good workaround except disabling the arity inspection, sorry. Ideally it would be possible to disable it by form, but that is not done yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment