You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Zemin Hu <ze...@hotmail.com> on 2013/02/14 20:30:45 UTC

How do I get instance of JobDetail from a quartz route

I have a route look like:
<route>
<from uri="quartz://report?cron=0+0/2+8-18+?+*+MON-FRI"/>
...
</route>
Inside of this route, I need to access the JobDetail or StdScheduler since
the configuration in the cron job may change, but I still can modify
business logic within the route based on changed time schedule. I can see
many information in the Camel HTTP headers:
jobDetail=JobDetail 'DEFAULT.quartz-endpoint70':  jobClass:
'org.apache.camel.component.quartz.CamelJob isStateful: false isVolatile:
false isDurable: false requestsRecovers: false, fireTime=Thu Feb 14 11:40:00
EST 2013, result=null, triggerGroup=modelshop,
scheduler=org.quartz.impl.StdScheduler@19d0c27, nextFireTime=Thu Feb 14
11:42:00 EST 2013, mergedJobDataMap=org.quartz.JobDataMap@b0eb8a97,
triggerName=api_health_report, jobRunTime=-1,
jobInstance=org.apache.camel.component.quartz.CamelJob@e37fe5,
CamelHttpMethod=GET, refireCount=0, scheduledFireTime=Thu Feb 14 11:40:00
EST 2013, previousFireTime=Thu Feb 14 11:38:00 EST 2013, calendar=null
but I need actual schedule, how can I access it? is there a bean I can
access from context or register by using names "jobDetail", "scheduler" or
"jobInstance" in the headers?




--
View this message in context: http://camel.465427.n5.nabble.com/How-do-I-get-instance-of-JobDetail-from-a-quartz-route-tp5727629.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How do I get instance of JobDetail from a quartz route

Posted by Zemin Hu <ze...@hotmail.com>.
Thanks. I will try this trick later.



--
View this message in context: http://camel.465427.n5.nabble.com/How-do-I-get-instance-of-JobDetail-from-a-quartz-route-tp5727629p5727669.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How do I get instance of JobDetail from a quartz route

Posted by Henryk Konsek <he...@gmail.com>.
Hi Zemin,

> <from uri="quartz://report?cron=0+0/2+8-18+?+*+MON-FRI"/>
> I need to access the JobDetail

QuartzEndpoint quartzEndpoint = (QuartzEndpoint)
camelContext.getEdnpoint("quartz://report?cron=0+0/2+8-18+?+*+MON-FRI");
JobDetail jobDetail = quartzEndpoint.getJobDetail();

I'm afraid our documentation doesn't tell anything about accessing
endpoints internals in such manner :) . But yeah, this is definitely
possible.

Best regards.

--
Henryk Konsek
http://henryk-konsek.blogspot.com