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.ComponentAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasCamelContext,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.DefaultEndpoint
Schedule sending of messages using the Quartz 2.x scheduler.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.Producerprotected voiddoStart()protected voiddoStop()getCron()org.quartz.Calendarorg.quartz.TriggerKeylongbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidonConsumerStart(QuartzConsumer quartzConsumer) voidonConsumerStop(QuartzConsumer quartzConsumer) voidvoidvoidsetAutoStartScheduler(boolean autoStartScheduler) Whether or not the scheduler should be auto started.voidSpecifies 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, toStringMethods 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, suspendMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.ComponentAware
getComponentMethods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isSingletonProducerMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
QuartzEndpoint
-
-
Method Details
-
getGroupName
-
getTriggerName
-
setTriggerName
-
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. -
getTriggerParameters
-
setTriggerParameters
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.
-
getJobParameters
-
setJobParameters
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
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 -
createProducer
- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
getComponent
- Specified by:
getComponentin interfaceorg.apache.camel.ComponentAware- Overrides:
getComponentin classorg.apache.camel.support.DefaultEndpoint
-
pauseTrigger
- Throws:
Exception
-
resumeTrigger
- Throws:
Exception
-
onConsumerStart
- Throws:
Exception
-
onConsumerStop
- Throws:
Exception
-