michaelklishin / quartz-mongodb

A MongoDB-based store for the Quartz scheduler. This fork strives to be as feature complete as possible. Originally by MuleSoft.
Other
250 stars 202 forks source link

Feature request or just a Q #212

Open otlg opened 3 years ago

otlg commented 3 years ago

Hi,

I faced the issue when the quartz-mongodb fails to serialize the job due to ClassNotFoundException. That's OK, the class no longer exists in the classpath.

However, I'd like to recover from this situation, for example by job deletion. The problem that the exception thrown from JobConverter.toJobDetail and handled in SchedulerListenerSupport.schedulerError does not contain any information about the job, except its class name.

Can full job info doc be added to the exception?

If you have any other solution to recover, will be happy for sharing.

Thanks, Oleg.

wakecaine1 commented 3 years ago

From technical point of view this should not happen in normal production environment as it is very specific. Tho if you must do it, you can for example pre-initialize Quartz, do a check if there are jobs with specific class name by using normal mongo connector and delete records. However, I would actually recommend to think beforehand and never make it so there are running jobs with classes that don't exist anymore in your code. It is just bad practice in my opinion to delete classes of existing jobs.