0

I am new to Quartz, and I have been reading the documentation but I couldn't find what I need.

I have several jobs that we schedule/run with Quartz, and I would like to tell it to run a method when it creates a new thread for a Job.

The code I want to run is generic and I need to run it during the thread start.

I understand that I could achieve what I want if I create a JobBase class with my code and have all my Jobs inherit from it; but since this would require several modifications and this code is not really concern of the Jobs I was wondering if there is some feature in Quartz that would allow me to accomplish what I need without modifying them.

Can you tell Quartz to run a method when it creates a Thread/Job during the thread start?

Dzyann
  • 5,062
  • 11
  • 63
  • 95
  • In Quartz 2.x the scheduler creates a defined count of threads when it starts. There is no way to execute a method on thread start, but you can use a job factory and execute there your code when a job is created. Take a look [here](https://stackoverflow.com/a/42158004/6666799) to see how you can create a job factory. – Rabban Nov 16 '17 at 09:16

1 Answers1

0

Implement IJobListener or extend JobListenerSupport and implement or override the JobToBeExecuted method. As explained here, register your listener each time you application runs.

Rafał Rutkowski
  • 1,419
  • 10
  • 11