Class QuartzEndpoint
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.DefaultEndpoint
-
- org.apache.camel.component.quartz.QuartzEndpoint
-
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasId,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="2.12.0", scheme="quartz", title="Quartz", syntax="quartz:groupName/triggerName", consumerOnly=true, category=SCHEDULING) public class QuartzEndpoint extends org.apache.camel.support.DefaultEndpointSchedule sending of messages using the Quartz 2.x scheduler.
-
-
Constructor Summary
Constructors Constructor Description QuartzEndpoint(String uri, QuartzComponent quartzComponent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor)org.apache.camel.ProducercreateProducer()protected voiddoStart()protected voiddoStop()QuartzComponentgetComponent()StringgetCron()org.quartz.CalendargetCustomCalendar()StringgetGroupName()Map<String,Object>getJobParameters()org.quartz.TriggerKeygetTriggerKey()StringgetTriggerName()Map<String,Object>getTriggerParameters()longgetTriggerStartDelay()booleanisAutoStartScheduler()booleanisDeleteJob()booleanisDurableJob()booleanisIgnoreExpiredNextFireTime()booleanisPauseJob()booleanisPrefixJobNameWithEndpointId()booleanisRecoverableJob()booleanisStateful()booleanisUsingFixedCamelContextName()voidonConsumerStart(QuartzConsumer quartzConsumer)voidonConsumerStop(QuartzConsumer quartzConsumer)voidpauseTrigger()voidresumeTrigger()voidsetAutoStartScheduler(boolean autoStartScheduler)Whether or not the scheduler should be auto started.voidsetCron(String cron)Specifies a cron expression to define when to trigger.voidsetCustomCalendar(org.quartz.Calendar customCalendar)Specifies a custom calendar to avoid specific range of datevoidsetDeleteJob(boolean deleteJob)If set to true, then the trigger automatically delete when route stop.voidsetDurableJob(boolean durableJob)Whether or not the job should remain stored after it is orphaned (no triggers point to it).voidsetIgnoreExpiredNextFireTime(boolean ignoreExpiredNextFireTime)Whether to ignore quartz cannot schedule a trigger because the trigger will never fire in the future.voidsetJobParameters(Map<String,Object> jobParameters)To configure additional options on the job.voidsetPauseJob(boolean pauseJob)If set to true, then the trigger automatically pauses when route stop.voidsetPrefixJobNameWithEndpointId(boolean prefixJobNameWithEndpointId)Whether the job name should be prefixed with endpoint idvoidsetRecoverableJob(boolean recoverableJob)Instructs the scheduler whether or not the job should be re-executed if a 'recovery' or 'fail-over' situation is encountered.voidsetStateful(boolean stateful)Uses a Quartz @PersistJobDataAfterExecution and @DisallowConcurrentExecution instead of the default job.voidsetTriggerKey(org.quartz.TriggerKey triggerKey)voidsetTriggerName(String triggerName)voidsetTriggerParameters(Map<String,Object> triggerParameters)To configure additional options on the trigger.voidsetTriggerStartDelay(long triggerStartDelay)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.voidsetUsingFixedCamelContextName(boolean 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.-
Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
QuartzEndpoint
public QuartzEndpoint(String uri, QuartzComponent quartzComponent)
-
-
Method Detail
-
getGroupName
public String getGroupName()
-
getTriggerName
public String getTriggerName()
-
setTriggerName
public void setTriggerName(String triggerName)
-
getCron
public String getCron()
-
isStateful
public boolean isStateful()
-
isIgnoreExpiredNextFireTime
public boolean isIgnoreExpiredNextFireTime()
-
setIgnoreExpiredNextFireTime
public void setIgnoreExpiredNextFireTime(boolean ignoreExpiredNextFireTime)
Whether to ignore quartz cannot schedule a trigger because the trigger will never fire in the future. This can happen when using a cron trigger that are configured to only run in the past. By default, Quartz will fail to schedule the trigger and therefore fail to start the Camel route. You can set this to true which then logs a WARN and then ignore the problem, meaning that the route will never fire in the future.
-
getTriggerStartDelay
public long getTriggerStartDelay()
-
isDeleteJob
public boolean isDeleteJob()
-
isPauseJob
public boolean isPauseJob()
-
setPauseJob
public void setPauseJob(boolean 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.
-
setTriggerStartDelay
public void setTriggerStartDelay(long triggerStartDelay)
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. Negative value shifts trigger start time in the past.
-
setDeleteJob
public void setDeleteJob(boolean deleteJob)
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.
-
setStateful
public void setStateful(boolean stateful)
Uses a Quartz @PersistJobDataAfterExecution and @DisallowConcurrentExecution instead of the default job.
-
isDurableJob
public boolean isDurableJob()
-
setDurableJob
public void setDurableJob(boolean durableJob)
Whether or not the job should remain stored after it is orphaned (no triggers point to it).
-
isRecoverableJob
public boolean isRecoverableJob()
-
setRecoverableJob
public void setRecoverableJob(boolean recoverableJob)
Instructs the scheduler whether or not the job should be re-executed if a 'recovery' or 'fail-over' situation is encountered.
-
isUsingFixedCamelContextName
public boolean isUsingFixedCamelContextName()
-
setUsingFixedCamelContextName
public void setUsingFixedCamelContextName(boolean 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.
-
setTriggerParameters
public void setTriggerParameters(Map<String,Object> triggerParameters)
To configure additional options on the trigger. The parameter timeZone is supported if the cron option is present. Otherwise the parameters repeatInterval and repeatCount are supported.Note: When using repeatInterval values of 1000 or less, the first few events after starting the camel context may be fired more rapidly than expected.
-
setJobParameters
public void setJobParameters(Map<String,Object> jobParameters)
To configure additional options on the job.
-
isAutoStartScheduler
public boolean isAutoStartScheduler()
-
setAutoStartScheduler
public void setAutoStartScheduler(boolean autoStartScheduler)
Whether or not the scheduler should be auto started.
-
isPrefixJobNameWithEndpointId
public boolean isPrefixJobNameWithEndpointId()
-
setPrefixJobNameWithEndpointId
public void setPrefixJobNameWithEndpointId(boolean prefixJobNameWithEndpointId)
Whether the job name should be prefixed with endpoint id- Parameters:
prefixJobNameWithEndpointId-
-
setCron
public void setCron(String cron)
Specifies a cron expression to define when to trigger.
-
getTriggerKey
public org.quartz.TriggerKey getTriggerKey()
-
setTriggerKey
public void setTriggerKey(org.quartz.TriggerKey triggerKey)
-
getCustomCalendar
public org.quartz.Calendar getCustomCalendar()
-
setCustomCalendar
public void setCustomCalendar(org.quartz.Calendar customCalendar)
Specifies a custom calendar to avoid specific range of date
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception- Throws:
Exception
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
getComponent
public QuartzComponent getComponent()
- Overrides:
getComponentin classorg.apache.camel.support.DefaultEndpoint
-
onConsumerStart
public void onConsumerStart(QuartzConsumer quartzConsumer) throws Exception
- Throws:
Exception
-
onConsumerStop
public void onConsumerStop(QuartzConsumer quartzConsumer) throws Exception
- Throws:
Exception
-
-