Reputation: 101
We have 2 applications that uses quartz for scheduling. The quartz.properties for our application is as follows :
org.quartz.scheduler.instanceName = sr22QuartzScheduler
org.quartz.scheduler.instanceId = AUTO
org.quartz.scheduler.skipUpdateCheck = true
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 2
org.quartz.threadPool.threadPriority = 5
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.isClustered = true
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = quartzDS
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.clusterCheckinInterval = 20000
org.quartz.scheduler.idleWaitTime=1000
#org.quartz.jobStore.acquireTriggersWithinLock=true
#Adding unusually high misfire threshold as we dont want to handle misfires
org.quartz.jobStore.misfireThreshold = 50000000
#org.quartz.jobStore.maxMisfiresToHandleAtATime = 0
org.quartz.dataSource.quartzDS.jndiURL= java:jdbc/quartzDS
org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin
org.quartz.plugin.shutdownhook.cleanShutdown = false
#org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin
#org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger \{1\}.\{0\} fired job \{6\}.\{5\} at: \{4, date, HH:mm:ss MM/dd/yyyy}
#org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger \{1\}.\{0\} completed firing job \{6\}.\{5\} at \{4, date, HH:mm:ss MM/dd/yyyy\}
The other application have the same configuration but with a different instanceName.
Both applications will be running on same set of server instances. Both of them uses the same set of tables as Quartz Job store in the database.
Now the problem is :
If both the applications are running at the same time, the triggers are not routed properly. The triggers from application1 are routed to application2 and vice-versa. This happens randomly.
Should the applications use different set of quatrz tables in the same database? Should we have only one quartz scheduler instance per server for multiple applications?
I am seeing a random behaviour with quartz. Is there any thing wrong with our setup ??
BTW, we are using quartz 1.8.
Any help is appreciated.
Thanks, Sri Harsha Yenuganti.
Upvotes: 4
Views: 7810
Reputation: 509
On version 1.x, you have to use multiples table set per scheduler.
On version 2.x, you can use a single set of tables. There is a new discriminator column on each table that contains the scheduler name (SCHED_NAME
).
Upvotes: 3
Reputation: 788
"The other application have the same configuration but with a different instanceName."
To enable clustering:
use only a SINGLE scheduler instance name (but with different instance IDs)
point to a single set of tables
Upvotes: 2