Repository: camel Updated Branches: refs/heads/master ba9bd8cb2 -> 97bcd3b39
Component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/97bcd3b3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/97bcd3b3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/97bcd3b3 Branch: refs/heads/master Commit: 97bcd3b39b90a12f7f06a956af0e0d0840527d39 Parents: 06eae5e Author: Claus Ibsen <davscl...@apache.org> Authored: Thu May 7 14:24:15 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu May 7 14:31:54 2015 +0200 ---------------------------------------------------------------------- .../camel/component/quartz/QuartzComponent.java | 1 + .../camel/component/quartz/QuartzEndpoint.java | 13 +++++ .../component/quartz2/QuartzComponent.java | 54 +++++++++++++---- .../camel/component/quartz2/QuartzEndpoint.java | 61 +++++++++++++++----- 4 files changed, 103 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/97bcd3b3/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java index 6fdde5b..53a81e5 100644 --- a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java +++ b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java @@ -161,6 +161,7 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList QuartzEndpoint answer = new QuartzEndpoint(uri, this); answer.setGroupName(group); answer.setTimerName(name); + answer.setCron(cron); setProperties(answer.getJobDetail(), jobParameters); http://git-wip-us.apache.org/repos/asf/camel/blob/97bcd3b3/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java index 51721e5..fb569a1 100644 --- a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java +++ b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java @@ -60,6 +60,8 @@ public class QuartzEndpoint extends DefaultEndpoint implements ShutdownableServi @UriPath @Metadata(required = "true") private String timerName; @UriParam + private String cron; + @UriParam private boolean stateful; @UriParam(defaultValue = "true") private boolean deleteJob = true; @@ -212,6 +214,17 @@ public class QuartzEndpoint extends DefaultEndpoint implements ShutdownableServi this.timerName = timerName; } + public String getCron() { + return cron; + } + + /** + * Specifies a cron expression to define when to trigger. + */ + public void setCron(String cron) { + this.cron = cron; + } + public void setLoadBalancer(final LoadBalancer loadBalancer) { this.loadBalancer = loadBalancer; } http://git-wip-us.apache.org/repos/asf/camel/blob/97bcd3b3/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java index a6cab8f..78f26a6 100644 --- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java +++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java @@ -67,26 +67,39 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList super(camelContext, QuartzEndpoint.class); } - public int getStartDelayedSeconds() { - return startDelayedSeconds; - } - public boolean isAutoStartScheduler() { return autoStartScheduler; } - public void setStartDelayedSeconds(int startDelayedSeconds) { - this.startDelayedSeconds = startDelayedSeconds; - } - + /** + * Whether or not the scheduler should be auto started. + * <p/> + * This options is default true + */ public void setAutoStartScheduler(boolean autoStartScheduler) { this.autoStartScheduler = autoStartScheduler; } + public int getStartDelayedSeconds() { + return startDelayedSeconds; + } + + /** + * Seconds to wait before starting the quartz scheduler. + */ + public void setStartDelayedSeconds(int startDelayedSeconds) { + this.startDelayedSeconds = startDelayedSeconds; + } + public boolean isPrefixJobNameWithEndpointId() { return prefixJobNameWithEndpointId; } + /** + * Whether to prefix the quartz job with the endpoint id. + * <p/> + * This option is default false. + */ public void setPrefixJobNameWithEndpointId(boolean prefixJobNameWithEndpointId) { this.prefixJobNameWithEndpointId = prefixJobNameWithEndpointId; } @@ -95,6 +108,11 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList return enableJmx; } + /** + * Whether to enable Quartz JMX which allows to manage the Quartz scheduler from JMX. + * <p/> + * This options is default true + */ public void setEnableJmx(boolean enableJmx) { this.enableJmx = enableJmx; } @@ -103,14 +121,20 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList return properties; } - public String getPropertiesFile() { - return propertiesFile; - } - + /** + * Properties to configure the Quartz scheduler. + */ public void setProperties(Properties properties) { this.properties = properties; } + public String getPropertiesFile() { + return propertiesFile; + } + + /** + * File name of the properties to load from the classpath + */ public void setPropertiesFile(String propertiesFile) { this.propertiesFile = propertiesFile; } @@ -226,6 +250,9 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList return answer; } + /** + * To use the custom SchedulerFactory which is used to create the Scheduler. + */ public void setSchedulerFactory(SchedulerFactory schedulerFactory) { this.schedulerFactory = schedulerFactory; } @@ -234,6 +261,9 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList return scheduler; } + /** + * To use the custom configured Quartz scheduler, instead of creating a new Scheduler. + */ public void setScheduler(Scheduler scheduler) { this.scheduler = scheduler; } http://git-wip-us.apache.org/repos/asf/camel/blob/97bcd3b3/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java index df331a9..e8bb885 100644 --- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java +++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java @@ -59,15 +59,19 @@ import static org.quartz.SimpleScheduleBuilder.simpleSchedule; public class QuartzEndpoint extends DefaultEndpoint { private static final Logger LOG = LoggerFactory.getLogger(QuartzEndpoint.class); private TriggerKey triggerKey; - @UriPath(defaultValue = "Camel") + private LoadBalancer consumerLoadBalancer; + private Map<String, Object> triggerParameters; + private Map<String, Object> jobParameters; + // An internal variables to track whether a job has been in scheduler or not, and has it paused or not. + private final AtomicBoolean jobAdded = new AtomicBoolean(false); + private final AtomicBoolean jobPaused = new AtomicBoolean(false); + + @UriPath(description = "The quartz group name to use. The combination of group name and timer name should be unique.", defaultValue = "Camel") private String groupName; @UriPath @Metadata(required = "true") private String triggerName; @UriParam private String cron; - private LoadBalancer consumerLoadBalancer; - private Map<String, Object> triggerParameters; - private Map<String, Object> jobParameters; @UriParam private boolean stateful; @UriParam @@ -80,20 +84,11 @@ public class QuartzEndpoint extends DefaultEndpoint { private boolean durableJob; @UriParam private boolean recoverableJob; - /** In case of scheduler has already started, we want the trigger start slightly after current time to - * ensure endpoint is fully started before the job kicks in. */ @UriParam(defaultValue = "500") - private long triggerStartDelay = 500; // in millis second - /** If it is true, the CamelContext name is used, - * if it is false, use the CamelContext management name which could be changed during the deploy time - **/ + private long triggerStartDelay = 500; @UriParam private boolean usingFixedCamelContextName; - // An internal variables to track whether a job has been in scheduler or not, and has it paused or not. - private final AtomicBoolean jobAdded = new AtomicBoolean(false); - private final AtomicBoolean jobPaused = new AtomicBoolean(false); - public QuartzEndpoint(String uri, QuartzComponent quartzComponent) { super(uri, quartzComponent); } @@ -106,6 +101,9 @@ public class QuartzEndpoint extends DefaultEndpoint { return triggerKey.getName(); } + /** + * The quartz timer name to use. The combination of group name and timer name should be unique. + */ public void setTriggerName(String triggerName) { this.triggerName = triggerName; } @@ -134,22 +132,44 @@ public class QuartzEndpoint extends DefaultEndpoint { return pauseJob; } + /** + * If set to true, then the trigger automatically pauses when route stop. + * Else if set to false, it will remain in scheduler. When set to false, it will also mean user may reuse + * pre-configured trigger with camel Uri. Just ensure the names match. + * Notice you cannot have both deleteJob and pauseJob set to true. + */ public void setPauseJob(boolean pauseJob) { this.pauseJob = pauseJob; } + /** + * In case of scheduler has already started, we want the trigger start slightly after current time to + * ensure endpoint is fully started before the job kicks in. + */ public void setTriggerStartDelay(long triggerStartDelay) { this.triggerStartDelay = triggerStartDelay; } + /** + * If set to true, then the trigger automatically delete when route stop. + * Else if set to false, it will remain in scheduler. When set to false, it will also mean user may reuse + * pre-configured trigger with camel Uri. Just ensure the names match. + * Notice you cannot have both deleteJob and pauseJob set to true. + */ public void setDeleteJob(boolean deleteJob) { this.deleteJob = deleteJob; } + /** + * If it is true will fire the trigger when the route is start when using SimpleTrigger. + */ public void setFireNow(boolean fireNow) { this.fireNow = fireNow; } + /** + * Uses a Quartz @PersistJobDataAfterExecution and @DisallowConcurrentExecution instead of the default job. + */ public void setStateful(boolean stateful) { this.stateful = stateful; } @@ -158,6 +178,9 @@ public class QuartzEndpoint extends DefaultEndpoint { return durableJob; } + /** + * Whether or not the job should remain stored after it is orphaned (no triggers point to it). + */ public void setDurableJob(boolean durableJob) { this.durableJob = durableJob; } @@ -166,6 +189,9 @@ public class QuartzEndpoint extends DefaultEndpoint { return recoverableJob; } + /** + * Instructs the scheduler whether or not the job should be re-executed if a 'recovery' or 'fail-over' situation is encountered. + */ public void setRecoverableJob(boolean recoverableJob) { this.recoverableJob = recoverableJob; } @@ -174,6 +200,10 @@ public class QuartzEndpoint extends DefaultEndpoint { return usingFixedCamelContextName; } + /** + * If it is true, JobDataMap uses the CamelContext name directly to reference the CamelContext, + * if it is false, JobDataMap uses use the CamelContext management name which could be changed during the deploy time. + */ public void setUsingFixedCamelContextName(boolean usingFixedCamelContextName) { this.usingFixedCamelContextName = usingFixedCamelContextName; } @@ -197,6 +227,9 @@ public class QuartzEndpoint extends DefaultEndpoint { this.consumerLoadBalancer = consumerLoadBalancer; } + /** + * Specifies a cron expression to define when to trigger. + */ public void setCron(String cron) { this.cron = cron; }