Hi there,

I have a Spring application which defines Camel routes triggered using
camel-quartz2 (v2.14.0). The Quartz Camel routes I have configured
successfully trigger when I run a single instance of the app (i.e
non-clustered, in-memory quartz scheduler).

However, I now want to set this up in a clustered environment, where I can
have multiple instances of my application and a single mySQL database to
store the scheduled jobs for the Camel routes. I want only a single instance
of my app to run when a triggered route fires. I started to follow  this
example
<https://github.com/apache/camel/blob/master/components/camel-quartz2/src/test/resources/org/apache/camel/component/quartz2/SpringQuartzConsumerClusteredAppTwo.xml>
  
from Camel's GitHub repo in order hook my Camel routes into my clustered
Quartz scheduler. However I am confused by 2 parts of the bean declarations
given in this example. The first source of confusion is the bean declaration
below:

<bean id="quartz2"
class="org.apache.camel.component.quartz2.QuartzComponent">
    <property name="scheduler" ref="scheduler"/>
  </bean>

The reference above to the "scheduler" bean is an instance of
org.springframework.scheduling.quartz.SchedulerFactoryBean. However the
QuartzComponent class's scheduler property is of type org.quartz.Scheduler.
Therefore, I receive a ClassCastException when trying to set scheduler
property to an instance of
org.springframework.scheduling.quartz.SchedulerFactoryBean.

My second source of confusion is the declaration of "schedulerContextAsMap"
map shown below:

<property name="schedulerContextAsMap">
      
      <map>
        <entry key="CamelQuartzCamelContext-camelContext"
value-ref="camelContext2"/>
      </map>
    </property>

I am using Java configuration rather than XML for my bean declarations.
Therefore, should I be setting the value of the
"CamelQuartzCamelContext-camelContext" key to be an autowired instance of my
CamelContext?

I am new to Camel/Quartz so apologies if my question is difficult to reason
about. Please let me know if you need me to provide any further information
in order to clarify my issue.

Thanks,

Paul



--
View this message in context: 
http://camel.465427.n5.nabble.com/Spring-Camel-Quartz-cluster-configuration-tp5761825.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to