throw new JobExecutionException("Failed to obtain scheduler context for job " + context.getJobDetail().getKey());
}
}
protected QuartzEndpoint lookupQuartzEndpoint(CamelContext camelContext, JobExecutionContext quartzContext) throws JobExecutionException {
TriggerKey triggerKey = quartzContext.getTrigger().getKey();
if (LOG.isDebugEnabled()) {
LOG.debug("Looking up existing QuartzEndpoint with triggerKey={}", triggerKey);
}
// check all active routes for the quartz endpoint this task matches
// as we prefer to use the existing endpoint from the routes
for (Route route : camelContext.getRoutes()) {
if (route.getEndpoint() instanceof QuartzEndpoint) {
QuartzEndpoint quartzEndpoint = (QuartzEndpoint) route.getEndpoint();
TriggerKey checkTriggerKey = quartzEndpoint.getTriggerKey();
if (LOG.isTraceEnabled()) {
LOG.trace("Checking route endpoint={} with checkTriggerKey={}", quartzEndpoint, checkTriggerKey);
}
if (triggerKey.equals(checkTriggerKey)) {
return quartzEndpoint;