Class QuartzComponent
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultComponent
org.apache.camel.component.quartz.QuartzComponent
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Component,org.apache.camel.ExtendedStartupListener,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.StartupListener,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@Component("quartz")
public class QuartzComponent
extends org.apache.camel.support.DefaultComponent
implements org.apache.camel.ExtendedStartupListener
This component will hold a Quartz Scheduler that will provide scheduled timer based endpoint that generate a
QuartzMessage to a route.
-
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 TypeMethodDescriptionvoidAdds a task to be executed as part of initializing and starting the scheduler; or executes the task if the scheduler has already been started.protected org.apache.camel.Endpointprotected StringcreateInstanceName(Properties prop) protected voiddoStart()protected voidprotected voiddoStop()org.quartz.Schedulerorg.quartz.SchedulerFactorybooleanbooleanIs the quartz scheduler clustered?booleanbooleanbooleanbooleanbooleanvoidonCamelContextFullyStarted(org.apache.camel.CamelContext context, boolean alreadyStarted) voidonCamelContextStarted(org.apache.camel.CamelContext context, boolean alreadyStarted) voidsetAutoStartScheduler(boolean autoStartScheduler) Whether the scheduler should be auto started.voidsetEnableJmx(boolean enableJmx) Whether to enable Quartz JMX which allows to manage the Quartz scheduler from JMX.voidsetIgnoreExpiredNextFireTime(boolean ignoreExpiredNextFireTime) Whether to ignore quartz cannot schedule a trigger because the trigger will never fire in the future.voidsetInterruptJobsOnShutdown(boolean interruptJobsOnShutdown) Whether to interrupt jobs on shutdown which forces the scheduler to shutdown quicker and attempt to interrupt any running jobs.voidsetPrefixInstanceName(boolean prefixInstanceName) Whether to prefix the Quartz Scheduler instance name with the CamelContext name.voidsetPrefixJobNameWithEndpointId(boolean prefixJobNameWithEndpointId) Whether to prefix the quartz job with the endpoint id.voidsetProperties(Map properties) Properties to configure the Quartz scheduler.voidsetPropertiesFile(String propertiesFile) File name of the properties to load from the classpathvoidsetPropertiesRef(String propertiesRef) References to an existingPropertiesorMapto lookup in the registry to use for configuring quartz.voidsetScheduler(org.quartz.Scheduler scheduler) To use the custom configured Quartz scheduler, instead of creating a new Scheduler.voidsetSchedulerFactory(org.quartz.SchedulerFactory schedulerFactory) To use the custom SchedulerFactory which is used to create the Scheduler.Methods inherited from class org.apache.camel.support.DefaultComponent
afterConfiguration, createEndpoint, createEndpoint, doBuild, doInit, getAndRemoveOrResolveReferenceParameter, getAndRemoveOrResolveReferenceParameter, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, getComponentPropertyConfigurer, getDefaultName, getEndpointPropertyConfigurer, getExtension, getSupportedExtensions, ifStartsWithReturnRemainder, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, registerExtension, registerExtension, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, resolveRawParameterValues, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setLazyStartProducer, setProperties, setProperties, setProperties, useIntrospectionOnEndpoint, useRawUri, validateParameters, validateURIMethods inherited from class org.apache.camel.support.service.BaseService
build, 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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.StartupListener
onCamelContextStartingMethods 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
-
QuartzComponent
public QuartzComponent() -
QuartzComponent
public QuartzComponent(org.apache.camel.CamelContext camelContext)
-
-
Method Details
-
isAutoStartScheduler
public boolean isAutoStartScheduler() -
setAutoStartScheduler
public void setAutoStartScheduler(boolean autoStartScheduler) Whether the scheduler should be auto started. This option is default true -
isPrefixJobNameWithEndpointId
public boolean isPrefixJobNameWithEndpointId() -
setPrefixJobNameWithEndpointId
public void setPrefixJobNameWithEndpointId(boolean prefixJobNameWithEndpointId) Whether to prefix the quartz job with the endpoint id. This option is default false. -
isEnableJmx
public boolean isEnableJmx() -
setEnableJmx
public void setEnableJmx(boolean enableJmx) Whether to enable Quartz JMX which allows to manage the Quartz scheduler from JMX. This options is default true -
getPropertiesRef
-
setPropertiesRef
References to an existingPropertiesorMapto lookup in the registry to use for configuring quartz. -
getProperties
-
setProperties
Properties to configure the Quartz scheduler. -
getPropertiesFile
-
setPropertiesFile
File name of the properties to load from the classpath -
isPrefixInstanceName
public boolean isPrefixInstanceName() -
setPrefixInstanceName
public void setPrefixInstanceName(boolean prefixInstanceName) Whether to prefix the Quartz Scheduler instance name with the CamelContext name. This is enabled by default, to let each CamelContext use its own Quartz scheduler instance by default. You can set this option to false to reuse Quartz scheduler instances between multiple CamelContext's. -
isInterruptJobsOnShutdown
public boolean isInterruptJobsOnShutdown() -
setInterruptJobsOnShutdown
public void setInterruptJobsOnShutdown(boolean interruptJobsOnShutdown) Whether to interrupt jobs on shutdown which forces the scheduler to shutdown quicker and attempt to interrupt any running jobs. If this is enabled then any running jobs can fail due to being interrupted. When a job is interrupted then Camel will mark the exchange to stop continue routing and setRejectedExecutionExceptionas caused exception. Therefore use this with care, as its often better to allow Camel jobs to complete and shutdown gracefully. -
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. -
getSchedulerFactory
public org.quartz.SchedulerFactory getSchedulerFactory() -
createInstanceName
-
isClustered
public boolean isClustered() throws org.quartz.SchedulerExceptionIs the quartz scheduler clustered?- Throws:
org.quartz.SchedulerException
-
setSchedulerFactory
public void setSchedulerFactory(org.quartz.SchedulerFactory schedulerFactory) To use the custom SchedulerFactory which is used to create the Scheduler. -
getScheduler
public org.quartz.Scheduler getScheduler() -
addScheduleInitTask
Adds a task to be executed as part of initializing and starting the scheduler; or executes the task if the scheduler has already been started. -
setScheduler
public void setScheduler(org.quartz.Scheduler scheduler) To use the custom configured Quartz scheduler, instead of creating a new Scheduler. -
createEndpoint
protected org.apache.camel.Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception- Specified by:
createEndpointin classorg.apache.camel.support.DefaultComponent- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
onCamelContextStarted
public void onCamelContextStarted(org.apache.camel.CamelContext context, boolean alreadyStarted) throws Exception - Specified by:
onCamelContextStartedin interfaceorg.apache.camel.StartupListener- Throws:
Exception
-
onCamelContextFullyStarted
public void onCamelContextFullyStarted(org.apache.camel.CamelContext context, boolean alreadyStarted) throws Exception - Specified by:
onCamelContextFullyStartedin interfaceorg.apache.camel.StartupListener- Throws:
Exception
-
doStartScheduler
- Throws:
Exception
-