@ManagedResource(description="Managed TimerEndpoint") @UriEndpoint(firstVersion="1.0.0", scheme="timer", title="Timer", syntax="timer:timerName", consumerOnly=true, consumerClass=TimerConsumer.class, label="core,scheduling") public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Modifier | Constructor and Description |
---|---|
|
TimerEndpoint() |
protected |
TimerEndpoint(String endpointUri,
Component component) |
|
TimerEndpoint(String uri,
Component component,
String timerName) |
Modifier and Type | Method and Description |
---|---|
Consumer |
createConsumer(Processor processor)
Creates a new Event
Driven Consumer which consumes messages from the endpoint using the
given processor
|
Producer |
createProducer()
Creates a new producer which is used send messages into the endpoint
|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
TimerComponent |
getComponent()
Returns the component that created this endpoint.
|
long |
getDelay() |
String |
getPattern() |
long |
getPeriod() |
long |
getRepeatCount() |
Date |
getTime() |
Timer |
getTimer(TimerConsumer consumer) |
String |
getTimerName() |
boolean |
isDaemon() |
boolean |
isFixedRate() |
boolean |
isMultipleConsumersSupported()
Are multiple consumers supported?
|
boolean |
isSingleton()
Whether this class supports being singleton or not.
|
void |
removeTimer(TimerConsumer consumer) |
void |
setDaemon(boolean daemon)
Specifies whether or not the thread associated with the timer endpoint runs as a daemon.
|
void |
setDelay(long delay)
The number of milliseconds to wait before the first event is generated.
|
void |
setFixedRate(boolean fixedRate)
Events take place at approximately regular intervals, separated by the specified period.
|
void |
setPattern(String pattern)
Allows you to specify a custom Date pattern to use for setting the time option using URI syntax.
|
void |
setPeriod(long period)
If greater than 0, generate periodic events every period milliseconds.
|
void |
setRepeatCount(long repeatCount)
Specifies a maximum limit of number of fires.
|
void |
setTime(Date time)
A java.util.Date the first event should be generated.
|
void |
setTimer(Timer timer)
To use a custom
Timer |
void |
setTimerName(String timerName)
The name of the timer
|
configureConsumer, configurePollingConsumer, configureProperties, createEndpointConfiguration, createEndpointUri, createExchange, createExchange, createExchange, createPollingConsumer, equals, getCamelContext, getConsumerProperties, getEndpointConfiguration, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isBridgeErrorHandler, isLenientProperties, isPollingConsumerBlockWhenFull, isSynchronous, setBridgeErrorHandler, setCamelContext, setConsumerProperties, setEndpointConfiguration, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public TimerEndpoint()
public TimerEndpoint(String uri, Component component, String timerName)
protected TimerEndpoint(String endpointUri, Component component)
public TimerComponent getComponent()
DefaultEndpoint
getComponent
in class DefaultEndpoint
public Producer createProducer() throws Exception
Endpoint
createProducer
in interface Endpoint
Exception
- can be thrownpublic Consumer createConsumer(Processor processor) throws Exception
Endpoint
createConsumer
in interface Endpoint
processor
- the given processorException
- can be thrownpublic boolean isSingleton()
IsSingleton
isSingleton
in interface IsSingleton
protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class DefaultEndpoint
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.doStop
in class DefaultEndpoint
Exception
ServiceSupport.doStart()
@ManagedAttribute public boolean isMultipleConsumersSupported()
MultipleConsumersSupport
isMultipleConsumersSupported
in interface MultipleConsumersSupport
@ManagedAttribute(description="Timer Name") public String getTimerName()
@ManagedAttribute(description="Timer Name") public void setTimerName(String timerName)
@ManagedAttribute(description="Timer Daemon") public boolean isDaemon()
@ManagedAttribute(description="Timer Daemon") public void setDaemon(boolean daemon)
@ManagedAttribute(description="Timer Delay") public long getDelay()
@ManagedAttribute(description="Timer Delay") public void setDelay(long delay)
@ManagedAttribute(description="Timer FixedRate") public boolean isFixedRate()
@ManagedAttribute(description="Timer FixedRate") public void setFixedRate(boolean fixedRate)
@ManagedAttribute(description="Timer Period") public long getPeriod()
@ManagedAttribute(description="Timer Period") public void setPeriod(long period)
@ManagedAttribute(description="Repeat Count") public long getRepeatCount()
@ManagedAttribute(description="Repeat Count") public void setRepeatCount(long repeatCount)
public void setTime(Date time)
public String getPattern()
public void setPattern(String pattern)
public Timer getTimer(TimerConsumer consumer)
public void removeTimer(TimerConsumer consumer)
Apache Camel