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
249 stars 203 forks source link

How to share Mongo database instance with MongoDBStore? #165

Closed titogarcia closed 4 years ago

titogarcia commented 6 years ago

The easiest and safest way I have found is to define my own extension of MongoDBStore, taking the database instance from a static field:

  public static class MyMongoDBJobStore extends MongoDBJobStore {
    public MyMongoDBJobStore() {
      super(Mongo.database);
    }
  }

Then setting org.quartz.jobStore.class to this class.

Is there a different recommended way?

Thanks

michaelklishin commented 4 years ago

Unless you start Quartz and configure it using Java code, I don't think this is something that this project supports.