Class DefaultScheduledPollConsumer

  • All Implemented Interfaces:
    AutoCloseable, Runnable, org.apache.camel.Consumer, org.apache.camel.EndpointAware, org.apache.camel.PollingConsumerPollingStrategy, org.apache.camel.RouteAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, 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 Detail

      • 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 Detail

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