camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nestor Urquiza <nestor.urqu...@gmail.com>
Subject Configure Camel to consume externally configured quartz jobs
Date Mon, 21 May 2012 00:28:40 GMT
Hi guys,

How can I configure Camel to consume quartz jobs that are configured outside
of camel?

I can start a persisted quartz consumer without problems. I can later
reschedule it using the quartz API and I can see the route is triggered as
expected. However when the app is restarted camel will reconfigure the job
with the cron parameter. 

If I do not supply the cron parameter I get the below:

2012-05-20 20:04:27,673 ERROR
[org.springframework.web.context.ContextLoader] -   Context initialization
failed
org.apache.camel.RuntimeCamelException: java.lang.ClassCastException:
org.quartz.SimpleTrigger cannot be cast to org.quartz.CronTrigger
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1221)
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)
	at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:240)
	at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
	at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324)
	at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:929)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:467)
	at
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
	at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
	at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
	at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
	at
org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
	at
org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassCastException: org.quartz.SimpleTrigger cannot be
cast to org.quartz.CronTrigger

One option could be to pass a parameter to tell Camel not to modify the job
if it already exists.

Another option is to provide a specific class to be invoked by quartz and
from that class to use Producer Template to invoke a Camel route. Before
going that way I want to understand if this could be a feature request that
makes sense: Allowing the Camel quartz producer to not update the persisted
quartz job.

It looks to me this should be a common request (to dynamically reconfigure
quartz producers)

Thanks in advance,

-Nestor



--
View this message in context: http://camel.465427.n5.nabble.com/Configure-Camel-to-consume-externally-configured-quartz-jobs-tp5712732.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message