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.DefaultEndpoint
Schedule 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.Consumer
createConsumer(org.apache.camel.Processor processor)
org.apache.camel.Producer
createProducer()
protected void
doStart()
protected void
doStop()
QuartzComponent
getComponent()
String
getCron()
org.quartz.Calendar
getCustomCalendar()
String
getGroupName()
Map<String,Object>
getJobParameters()
int
getStartDelayedSeconds()
org.quartz.TriggerKey
getTriggerKey()
String
getTriggerName()
Map<String,Object>
getTriggerParameters()
long
getTriggerStartDelay()
boolean
isAutoStartScheduler()
boolean
isDeleteJob()
boolean
isDurableJob()
boolean
isIgnoreExpiredNextFireTime()
boolean
isPauseJob()
boolean
isPrefixJobNameWithEndpointId()
boolean
isRecoverableJob()
boolean
isStateful()
boolean
isUsingFixedCamelContextName()
void
onConsumerStart(QuartzConsumer quartzConsumer)
void
onConsumerStop(QuartzConsumer quartzConsumer)
void
pauseTrigger()
void
resumeTrigger()
void
setAutoStartScheduler(boolean autoStartScheduler)
Whether or not the scheduler should be auto started.void
setCron(String cron)
Specifies a cron expression to define when to trigger.void
setCustomCalendar(org.quartz.Calendar customCalendar)
Specifies a custom calendar to avoid specific range of datevoid
setDeleteJob(boolean deleteJob)
If set to true, then the trigger automatically delete when route stop.void
setDurableJob(boolean durableJob)
Whether or not the job should remain stored after it is orphaned (no triggers point to it).void
setIgnoreExpiredNextFireTime(boolean ignoreExpiredNextFireTime)
Whether to ignore quartz cannot schedule a trigger because the trigger will never fire in the future.void
setJobParameters(Map<String,Object> jobParameters)
To configure additional options on the job.void
setPauseJob(boolean pauseJob)
If set to true, then the trigger automatically pauses when route stop.void
setPrefixJobNameWithEndpointId(boolean prefixJobNameWithEndpointId)
Whether the job name should be prefixed with endpoint idvoid
setRecoverableJob(boolean recoverableJob)
Instructs the scheduler whether or not the job should be re-executed if a 'recovery' or 'fail-over' situation is encountered.void
setStartDelayedSeconds(int startDelayedSeconds)
Seconds to wait before starting the quartz scheduler.void
setStateful(boolean stateful)
Uses a Quartz @PersistJobDataAfterExecution and @DisallowConcurrentExecution instead of the default job.void
setTriggerKey(org.quartz.TriggerKey triggerKey)
void
setTriggerName(String triggerName)
void
setTriggerParameters(Map<String,Object> triggerParameters)
To configure additional options on the trigger.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.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.-
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.
-
setJobParameters
public void setJobParameters(Map<String,Object> jobParameters)
To configure additional options on the job.
-
getStartDelayedSeconds
public int getStartDelayedSeconds()
-
setStartDelayedSeconds
public void setStartDelayedSeconds(int startDelayedSeconds)
Seconds to wait before starting the quartz scheduler.
-
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:
doStart
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
getComponent
public QuartzComponent getComponent()
- Overrides:
getComponent
in 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
-
-