On Tuesday, October 23, 2012 7:15:20 AM UTC+2, Michael Klishin wrote:
2012/10/23 Luis Reyes
<l.ch...@gmail.com>
But when I schedule the job with the schedule function the job is not scheduled and a nullPointerException is thrown. If I eliminate the line where using-job-data is called, the job is scheduled.
What is the problem with the schedule function when data is added to the job?
Please post a stack trace. Most likely your own code tries to access job data in a way that throwsan NPE. Quartzite has special functions and tests covering job context and job data map access.
Was there a resolution to this? I'm getting similar mileage and I can't for the world of me figure out why.
I'm not seeing any stacktraces or NullPointerExceptions, though.
I am using quartzite 1.0.1 an this is my code:
(ns quartzite-test.core
(:require [clojurewerkz.quartzite.scheduler :as qs]
[clojurewerkz.quartzite.triggers :as t]
[clojurewerkz.quartzite.conversion :as qc])
(:use [clojurewerkz.quartzite.schedule.daily-interval :only [schedule
with-interval-in-seconds]]))
(j/defjob TestJob
[ctx]
(println "Here's my payload:" (qc/from-job-data ctx)))
(defn -main []
(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")))
trigger (t/build
(t/with-identity (t/key "banana-trigger"))
(t/start-now)
(t/with-schedule (schedule
(with-interval-in-seconds 5))))]
(qs/schedule job trigger)))
Using this code, I get only this in my console:
#inst "2013-01-18T22:24:15.000-00:00"
If I eliminate the row containing (j/using-job-data {:jack "in the box"})
the job will trigger every 5 seconds and give me this output:
#inst "2013-01-18T22:24:35.000-00:00"
Here's my payload: {}
Here's my payload: {}
Here's my payload: {}
Here's my payload: {}
And so on, and so forth...
Sticking the job data on either the job or the trigger seems to cause the job to never execute.
Any and all help appreciated!
/S