Class DefaultScheduledPollConsumer

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
All Implemented Interfaces:
AutoCloseable, Runnable, org.apache.camel.Consumer, org.apache.camel.EndpointAware, org.apache.camel.health.HealthCheckAware, org.apache.camel.PollingConsumerPollingStrategy, org.apache.camel.RouteAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HostedService, org.apache.camel.spi.RouteIdAware, org.apache.camel.StatefulService, org.apache.camel.Suspendable, org.apache.camel.SuspendableService

public class DefaultScheduledPollConsumer extends ScheduledPollConsumer
A default implementation of an event driven Consumer which uses the PollingConsumer
  • Constructor Details

    • DefaultScheduledPollConsumer

      public DefaultScheduledPollConsumer(DefaultEndpoint defaultEndpoint, org.apache.camel.Processor processor)
    • DefaultScheduledPollConsumer

      public DefaultScheduledPollConsumer(org.apache.camel.Endpoint endpoint, org.apache.camel.Processor processor, ScheduledExecutorService executor)
  • Method Details

    • poll

      protected int poll() throws Exception
      Description copied from class: ScheduledPollConsumer
      The polling method which is invoked periodically to poll this consumer
      Specified by:
      poll in class ScheduledPollConsumer
      Returns:
      number of messages polled, will be 0 if no message was polled at all.
      Throws:
      Exception - can be thrown if an exception occurred during polling
    • getTimeout

      public int getTimeout()
    • setTimeout

      public void setTimeout(int timeout)
      Sets a timeout to use with PollingConsumer.

      Use timeout invalid input: '<' 0 for PollingConsumer.receive().
      Use timeout == 0 for PollingConsumer.receiveNoWait().
      Use timeout > 0 for PollingConsumer.receive(long)}.
      The default timeout value is 0
      Parameters:
      timeout - the timeout value
    • doBuild

      protected void doBuild() throws Exception
      Overrides:
      doBuild in class ScheduledPollConsumer
      Throws:
      Exception
    • doInit

      protected void doInit() throws Exception
      Overrides:
      doInit in class ScheduledPollConsumer
      Throws:
      Exception
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class ScheduledPollConsumer
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class ScheduledPollConsumer
      Throws:
      Exception