Package org.apache.camel.component.timer
Class TimerEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.timer.TimerEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.ComponentAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.MultipleConsumersSupport,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
@ManagedResource(description="Managed TimerEndpoint")
@UriEndpoint(firstVersion="1.0.0",
scheme="timer",
title="Timer",
syntax="timer:timerName",
consumerOnly=true,
remote=false,
category={CORE,SCHEDULING},
headersClass=TimerConstants.class)
public class TimerEndpoint
extends org.apache.camel.support.DefaultEndpoint
implements org.apache.camel.MultipleConsumersSupport
Generate messages in specified intervals using
java.util.Timer.
This component is similar to the scheduler component, but has much less functionality.-
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
ConstructorsModifierConstructorDescriptionprotectedTimerEndpoint(String endpointUri, org.apache.camel.Component component) TimerEndpoint(String uri, org.apache.camel.Component component, String timerName) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.Producerprotected voiddoInit()protected voiddoStop()longgetDelay()longlongorg.apache.camel.LoggingLevelgetTime()getTimer()getTimer(TimerConsumer consumer) booleanisDaemon()booleanbooleanbooleanbooleanisRemote()booleanvoidremoveTimer(TimerConsumer consumer) voidsetDaemon(boolean daemon) Specifies whether the thread associated with the timer endpoint runs as a daemon.voidsetDelay(long delay) The number of milliseconds to wait before the first event is generated.voidsetFixedRate(boolean fixedRate) Events take place at approximately regular intervals, separated by the specified period.voidsetIncludeMetadata(boolean includeMetadata) Whether to include metadata in the exchange such as fired time, timer name, timer count etc.voidsetPattern(String pattern) Allows you to specify a custom Date pattern to use for setting the time option using URI syntax.voidsetPeriod(long period) Generate periodic events every period.voidsetRepeatCount(long repeatCount) Specifies a maximum limit for the number of fires.voidsetRunLoggingLevel(org.apache.camel.LoggingLevel runLoggingLevel) The consumer logs a start/complete log line when it polls.voidsetSynchronous(boolean synchronous) Sets whether synchronous processing should be strictly usedvoidA java.util.Date the first event should be generated.voidTo use a customTimervoidsetTimerName(String timerName) The name of the timerMethods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, 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, doStart, doSuspend, fail, getInternalLock, 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
-
TimerEndpoint
public TimerEndpoint() -
TimerEndpoint
-
TimerEndpoint
-
-
Method Details
-
isRemote
public boolean isRemote()- Specified by:
isRemotein interfaceorg.apache.camel.Endpoint
-
getComponent
- Specified by:
getComponentin interfaceorg.apache.camel.ComponentAware- Overrides:
getComponentin classorg.apache.camel.support.DefaultEndpoint
-
createProducer
- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
isMultipleConsumersSupported
@ManagedAttribute public boolean isMultipleConsumersSupported()- Specified by:
isMultipleConsumersSupportedin interfaceorg.apache.camel.MultipleConsumersSupport
-
getTimerName
-
setTimerName
The name of the timer -
isDaemon
@ManagedAttribute(description="Timer Daemon") public boolean isDaemon() -
setDaemon
@ManagedAttribute(description="Timer Daemon") public void setDaemon(boolean daemon) Specifies whether the thread associated with the timer endpoint runs as a daemon. The default value is true. -
getDelay
@ManagedAttribute(description="Timer Delay") public long getDelay() -
setDelay
@ManagedAttribute(description="Timer Delay") public void setDelay(long delay) The number of milliseconds to wait before the first event is generated. Should not be used in conjunction with the time option. The default value is 1000. -
isFixedRate
@ManagedAttribute(description="Timer FixedRate") public boolean isFixedRate() -
setFixedRate
@ManagedAttribute(description="Timer FixedRate") public void setFixedRate(boolean fixedRate) Events take place at approximately regular intervals, separated by the specified period. -
getRunLoggingLevel
@ManagedAttribute(description="The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.") public org.apache.camel.LoggingLevel getRunLoggingLevel() -
setRunLoggingLevel
@ManagedAttribute(description="The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.") public void setRunLoggingLevel(org.apache.camel.LoggingLevel runLoggingLevel) The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that. -
getPeriod
@ManagedAttribute(description="Timer Period") public long getPeriod() -
setPeriod
@ManagedAttribute(description="Timer Period") public void setPeriod(long period) Generate periodic events every period. Must be zero or positive value. The default value is 1000. -
getRepeatCount
@ManagedAttribute(description="Repeat Count") public long getRepeatCount() -
setRepeatCount
@ManagedAttribute(description="Repeat Count") public void setRepeatCount(long repeatCount) Specifies a maximum limit for the number of fires. Therefore, if you set it to 1, the timer will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever. -
getTime
-
setTime
A java.util.Date the first event should be generated. If using the URI, the pattern expected is: yyyy-MM-dd HH:mm:ss or yyyy-MM-dd'T'HH:mm:ss. -
getPattern
-
setPattern
Allows you to specify a custom Date pattern to use for setting the time option using URI syntax. -
getTimer
-
setTimer
To use a customTimer -
getTimer
-
isIncludeMetadata
@ManagedAttribute(description="Include metadata") public boolean isIncludeMetadata() -
setIncludeMetadata
@ManagedAttribute(description="Include metadata") public void setIncludeMetadata(boolean includeMetadata) Whether to include metadata in the exchange such as fired time, timer name, timer count etc. -
isSynchronous
@ManagedAttribute(description="Whether synchronous processing should be strictly used") public boolean isSynchronous() -
setSynchronous
public void setSynchronous(boolean synchronous) Sets whether synchronous processing should be strictly used -
removeTimer
-