You can access the IJobDetail of a given job. It has a property called JobDataMap that is what you are looking for.
Access JobDatamap before execution
-
29-06-2022 - |
Вопрос
Is there a way to retrieve the values of variables in a JobDataMap before the job executes?
I am basically trying to display the job's next chained job name in a view. The name is in the Datamap.
Решение
Другие советы
You can implement custom ITriggerListener
and/or IJobListener
in which you can use the TriggerFired
and JobToBeExecuted
respectively in order to manipulate the job data map.
I use the TriggerFired
for example for a "generic" database logging (all jobs triggered are input to DB without putting the code in the job itself).
These interfaces are mentioned in the tutorial
http://quartznet.sourceforge.net/tutorial/lesson_7.html
couldn't find it in the 2.0 docs but the code in GitHub (read the XML docs): https://github.com/quartznet/quartznet/blob/master/src/Quartz/ITriggerListener.cs https://github.com/quartznet/quartznet/blob/master/src/Quartz/IJobListener.cs
Also found a short tutorial: http://jvilalta.blogspot.co.il/2010/11/creating-quartznet-joblistener.html