Dave
Dave

Reputation: 67

How to configure Quartz DataSource URL dynamically?

I have spring application which runs in cloud foundry. Also, I am using spring-cloud-connector (CloudFoundryServiceInfoCreator) to retrieve URLs for various services, such as MariaDB, Redis, etc. I need to use Quartz for scheduling and I am following docs (http://www.quartz-scheduler.org/documentation/quartz-2.1.x/configuration/ConfigJDBCJobStoreClustering.html), where 'org.quartz.dataSource.myDS.URL' is hardcoded in property file. I need to be able to set it on runtime. Is there a way ? Or Quartz can only be configured through property file ? I doubt it.

Upvotes: 2

Views: 1311

Answers (1)

ck1
ck1

Reputation: 5443

You can dynamically create a Quartz StdSchedulerFactory from a java.util.Properties instance, which might give you the flexibility you're looking for.

For more details, see the Javadoc here:

http://www.quartz-scheduler.org/api/2.2.1/org/quartz/impl/StdSchedulerFactory.html

http://www.quartz-scheduler.org/api/2.2.1/org/quartz/impl/StdSchedulerFactory.html#StdSchedulerFactory(java.util.Properties)

Upvotes: 1

Related Questions