Interface ScheduledPollConsumerScheduler
- All Superinterfaces:
AutoCloseable, CamelContextAware, HasCamelContext, Service, ShutdownableService
Pluggable scheduler that controls when a
wakes up to poll its
source.
Polling consumers (file, FTP, mail, etc.) delegate all scheduling decisions to this SPI so that the polling trigger
can be replaced without changing the consumer itself. The default implementation uses a
invalid reference
org.apache.camel.support.ScheduledPollConsumer
ScheduledExecutorService with a fixed or initial delay, while the camel-quartz
component provides an alternative that accepts CRON expressions for time-based firing.
A scheduler is initialized via onInit(org.apache.camel.Consumer) and then activated by calling
startScheduler(), which begins firing the task registered with scheduleTask(Runnable). The consumer
task itself is responsible for calling the consumer's polling logic; the scheduler only controls the firing cadence.
See Polling Consumer in the Camel user manual.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the scheduler has been started.voidInitializes thisScheduledPollConsumerSchedulerwith the associatedConsumer.voidscheduleTask(Runnable task) Schedules the task to run.voidStarts the scheduler.voidAttempts to unschedules the last task which was scheduled.Methods inherited from interface CamelContextAware
setCamelContextMethods inherited from interface HasCamelContext
getCamelContextMethods inherited from interface ShutdownableService
shutdown
-
Method Details
-
onInit
Initializes thisScheduledPollConsumerSchedulerwith the associatedConsumer.- Parameters:
consumer- the consumer.
-
scheduleTask
-
unscheduleTask
void unscheduleTask()Attempts to unschedules the last task which was scheduled. An implementation may not implement this method. -
startScheduler
void startScheduler()Starts the scheduler. If the scheduler is already started, then this is a noop method call. -
isSchedulerStarted
boolean isSchedulerStarted()Whether the scheduler has been started.- Returns:
- true if started, false otherwise.
-