Class ScheduledPollEndpoint

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.support.ScheduledPollEndpoint
All Implemented Interfaces:
AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.ComponentAware, org.apache.camel.Endpoint, org.apache.camel.IsSingleton, 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
Direct Known Subclasses:
AbstractApiEndpoint, DefaultPollingEndpoint

public abstract class ScheduledPollEndpoint extends DefaultEndpoint
A base class for Endpoint which creates a ScheduledPollConsumer
  • Constructor Details

    • ScheduledPollEndpoint

      protected ScheduledPollEndpoint(String endpointUri, org.apache.camel.Component component)
    • ScheduledPollEndpoint

      protected ScheduledPollEndpoint()
  • Method Details

    • configureConsumer

      protected void configureConsumer(org.apache.camel.Consumer consumer) throws Exception
      Overrides:
      configureConsumer in class DefaultEndpoint
      Throws:
      Exception
    • configureProperties

      public void configureProperties(Map<String,Object> options)
      Specified by:
      configureProperties in interface org.apache.camel.Endpoint
      Overrides:
      configureProperties in class DefaultEndpoint
    • configureScheduledPollConsumerProperties

      protected void configureScheduledPollConsumerProperties(Map<String,Object> options)
    • doConfigureConsumer

      protected void doConfigureConsumer(org.apache.camel.Consumer consumer)
    • isStartScheduler

      public boolean isStartScheduler()
    • setStartScheduler

      public void setStartScheduler(boolean startScheduler)
      Whether the scheduler should be auto started.
    • getInitialDelay

      public long getInitialDelay()
    • setInitialDelay

      public void setInitialDelay(long initialDelay)
      Milliseconds before the first poll starts.

      The default value is 1000.

    • getDelay

      public long getDelay()
    • setDelay

      public void setDelay(long delay)
      Milliseconds before the next poll.

      The default value is 500.

    • getDefaultDelay

      public long getDefaultDelay()
      Gets the default delay.
    • getTimeUnit

      public TimeUnit getTimeUnit()
    • setTimeUnit

      public void setTimeUnit(TimeUnit timeUnit)
      Time unit for initialDelay and delay options.
    • isUseFixedDelay

      public boolean isUseFixedDelay()
    • setUseFixedDelay

      public void setUseFixedDelay(boolean useFixedDelay)
      Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.
    • getPollStrategy

      public org.apache.camel.spi.PollingConsumerPollStrategy getPollStrategy()
    • setPollStrategy

      public void setPollStrategy(org.apache.camel.spi.PollingConsumerPollStrategy pollStrategy)
      A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. In other words the error occurred while the polling was gathering information, for instance access to a file network failed so Camel cannot access it to scan for files. The default implementation will log the caused exception at WARN level and ignore it.
    • getRunLoggingLevel

      public org.apache.camel.LoggingLevel getRunLoggingLevel()
    • setRunLoggingLevel

      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.
    • isSendEmptyMessageWhenIdle

      public boolean isSendEmptyMessageWhenIdle()
    • setSendEmptyMessageWhenIdle

      public void setSendEmptyMessageWhenIdle(boolean sendEmptyMessageWhenIdle)
      If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead.
    • isGreedy

      public boolean isGreedy()
    • setGreedy

      public void setGreedy(boolean greedy)
      If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages.
    • setScheduler

      public void setScheduler(Object schedulerName)
      Allow to plugin a custom org.apache.camel.spi.ScheduledPollConsumerScheduler to use as the scheduler for firing when the polling consumer runs. This option is used for referring to one of the built-in schedulers either spring, or quartz. Using none refers to no scheduler to be used. Notice: If using a custom scheduler then the options for initialDelay, useFixedDelay, timeUnit, and scheduledExecutorService may not be in use. Use the text quartz to refer to use the Quartz scheduler; and use the text spring to use the Spring based; and use the text #myScheduler to refer to a custom scheduler by its id in the Registry. See Quartz page for an example.
    • getScheduler

      public Object getScheduler()
    • getSchedulerProperties

      public Map<String,Object> getSchedulerProperties()
    • setSchedulerProperties

      public void setSchedulerProperties(Map<String,Object> schedulerProperties)
      To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler.
    • getScheduledExecutorService

      public ScheduledExecutorService getScheduledExecutorService()
    • setScheduledExecutorService

      public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
      Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool. This option allows you to share a thread pool among multiple consumers.
    • getBackoffMultiplier

      public int getBackoffMultiplier()
    • setBackoffMultiplier

      public void setBackoffMultiplier(int backoffMultiplier)
      To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.
    • getBackoffIdleThreshold

      public int getBackoffIdleThreshold()
    • setBackoffIdleThreshold

      public void setBackoffIdleThreshold(int backoffIdleThreshold)
      The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.
    • getBackoffErrorThreshold

      public int getBackoffErrorThreshold()
    • setBackoffErrorThreshold

      public void setBackoffErrorThreshold(int backoffErrorThreshold)
      The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.
    • getRepeatCount

      public long getRepeatCount()
    • setRepeatCount

      public void setRepeatCount(long repeatCount)
      Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler 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.