ProblemBy default, the Quartz Transport uses a RAMJobStore to store scheduling information (job, triggers and
calendars) within memory. RAMJobStore is fast and lightweight, but all
scheduling information is lost when the process terminates.
This problem is exacerbated if you are using dynamic jobs, as you need to recreate them all.
SolutionIn order to persists all the scheduling information required you need to instruct Quartz Transport to use a JDBC JobStore. To do this, you must add quartz:factory-property elements as child nodes of quartz:connector and define the properties related to the JobStore and the DataSource that will point to the DataBase that will store all the information.
Find below an example configuration that uses MySQL:
<quartz:connector name="Quartz"validateConnections="true"doc:name="Quartz">
<service-overrides sessionHandler="org.mule.session.NullSessionHandler"/>
<quartz:factory-property key="org.quartz.scheduler.instanceName"value="InstanceNameForApp"/>
<quartz:factory-property key="org.quartz.jobStore.class"value="org.quartz.impl.jdbcjobstore.JobStoreTX"/>
<quartz:factory-property key="org.quartz.jobStore.driverDelegateClass"value="org.quartz.impl.jdbcjobstore.StdJDBCDelegate"/>
<quartz:factory-property key="org.quartz.jobStore.tablePrefix"value="QRTZ_"/>
<quartz:factory-property key="org.quartz.jobStore.isClustered"value="true"/>
<quartz:factory-property key="org.quartz.jobStore.dataSource"value="quartzDS"/>
<quartz:factory-property key="org.quartz.dataSource.quartzDS.driver"value="com.mysql.jdbc.Driver"/>
<quartz:factory-property key="org.quartz.dataSource.quartzDS.URL"value="jdbc:mysql://my-sql-server:3306/quartz"/>
<quartz:factory-property key="org.quartz.dataSource.quartzDS.user"value="quartz"/>
<quartz:factory-property key="org.quartz.dataSource.quartzDS.password"value="quartz"/>
</quartz:connector>You can find attached to this article the SQL scripts that work with the version 1.8.5 of Quartz, that has been bundled in Mule ESB since version 3.4.0.
Further References
Quartz 1.x Documentation - Configure JDBC-JobStoreTXQuartz 1.x Documentation - Configure DataSources