Passing parameters to Jobs with version 2.2.400.0 #502
Replies: 4 comments
-
JSON serialization should be quite resilient to adding new fields, so maybe write some tests against data written to file and then deserialize etc. Of course the new values won't be present for the old data but deserialization should work fine. I also suggest reading the documentation about job parameters. |
Beta Was this translation helpful? Give feedback.
-
Yes, serialization works, but i need the new parameters. |
Beta Was this translation helpful? Give feedback.
-
You need to load the triggers/jobs, update the contained deserialized object to have value in the new field and then update the jobs/triggers. |
Beta Was this translation helpful? Give feedback.
-
Ok, I understand the way, can you give me a piece of code as sample? |
Beta Was this translation helpful? Give feedback.
-
Version: 2.2.400.0
I am new to Quartz, and I "inherited" an old project, without any documentation, written by an unknows developer and I need to expand it, adding a new property to the Parameters class passed to the job.
In this project a job is created like below:
app.config is like below:
In this project i have an "ancestor" generic class, and all real Jobs inherits from this class:
When execution reach this point in jobDataMap the parameters class is the OLD class, without the new field, exactly the one loaded fron the trigger JOB_DATA field.
Any attempt to pass parameters to the job fails: at this point in jobDataMap my parameters are always lost.
First question:
How can I pass parameters (in ANY way) to a Job and retrieve them in the Run method?
Second question:
Or, how can I change the JOB_DATA field in QRTZ_TRIGGERS table?
Beta Was this translation helpful? Give feedback.
All reactions