Apache Quartz scheduler in cluster is not working when one node is down
katampavankumar Aug 31, 2015 7:22 AMHello,
Objective: Quartz scheduler should run the job (triggering the camel route) in any one active node at a time. When particular node is down, it should automatically trigger the job in another active node in the cluster without fail.
I have integrated quartz scheduler in my camel project and deployed the jar in 2 jboss-fuse instances running in 2 different window machines as cluster to run the job in active node at a time.
And quartz scheduler is triggering the camel route based on cron time configured in quartz.properties (eg: "5 * * * * ?") in one fuse instance successfully in the cluster. It is also printing the log message of the camel route during execution.
But when i shutdown this node and try to check whether the scheduler is automatically triggering the job in another fuse instance, it is throwing below exception in the fuse logs:
16:06:46,645 | INFO | heduler_Worker-1 | JobRunShell | 240 - org.apache.servicemix.bundles.quartz - 1.8.6.1 | Job DEFAULT.quartz-endpoint384 threw a JobExecutionException:
org.quartz.JobExecutionException: No CamelContext could be found with name: 61-OrderManagementService_Camel_Context
at org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[239:org.apache.camel.camel-quartz:2.10.0.redhat-60024]
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)[240:org.apache.servicemix.bundles.quartz:1.8.6.1]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[240:org.apache.servicemix.bundles.quartz:1.8.6.1]
Kindly give your inputs what needs to be done to avoid this error and trigger the route in another node when first node is down automatically.
Below are my quartz.properties:
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = MyClusteredScheduler
org.quartz.scheduler.instanceId = AUTO
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 25
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties = true
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000
#============================================================================
# Configure Datasources
#============================================================================
org.quartz.dataSource.myDS.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.myDS.URL = jdbc:mysql://10.179.16.151:3306/quartz6
org.quartz.dataSource.myDS.user = root
org.quartz.dataSource.myDS.password = mysql
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=select 0 from dual
#============================================================================
# Others
#============================================================================
org.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer = true
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
With Regards,
Pavan