Class ScheduledBatchPollingConsumer

  • All Implemented Interfaces:
    AutoCloseable, Runnable, org.apache.camel.BatchConsumer, 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.RouteIdAware, org.apache.camel.spi.ShutdownAware, org.apache.camel.spi.ShutdownPrepared, org.apache.camel.StatefulService, org.apache.camel.Suspendable, org.apache.camel.SuspendableService

    public abstract class ScheduledBatchPollingConsumer
    extends ScheduledPollConsumer
    implements org.apache.camel.BatchConsumer, org.apache.camel.spi.ShutdownAware
    A useful base class for any consumer which is polling batch based
    • Field Detail

      • shutdownRunningTask

        protected volatile org.apache.camel.ShutdownRunningTask shutdownRunningTask
      • pendingExchanges

        protected volatile int pendingExchanges
      • maxMessagesPerPoll

        protected int maxMessagesPerPoll
    • Constructor Detail

      • ScheduledBatchPollingConsumer

        public ScheduledBatchPollingConsumer​(org.apache.camel.Endpoint endpoint,
                                             org.apache.camel.Processor processor)
      • ScheduledBatchPollingConsumer

        public ScheduledBatchPollingConsumer​(org.apache.camel.Endpoint endpoint,
                                             org.apache.camel.Processor processor,
                                             ScheduledExecutorService executor)
    • Method Detail

      • deferShutdown

        public boolean deferShutdown​(org.apache.camel.ShutdownRunningTask shutdownRunningTask)
        Specified by:
        deferShutdown in interface org.apache.camel.spi.ShutdownAware
      • getPendingExchangesSize

        public int getPendingExchangesSize()
        Specified by:
        getPendingExchangesSize in interface org.apache.camel.spi.ShutdownAware
      • prepareShutdown

        public void prepareShutdown​(boolean suspendOnly,
                                    boolean forced)
        Specified by:
        prepareShutdown in interface org.apache.camel.spi.ShutdownPrepared
      • setMaxMessagesPerPoll

        public void setMaxMessagesPerPoll​(int maxMessagesPerPoll)
        Specified by:
        setMaxMessagesPerPoll in interface org.apache.camel.BatchConsumer
      • getMaxMessagesPerPoll

        public int getMaxMessagesPerPoll()
        Gets the maximum number of messages as a limit to poll at each polling.

        Is default unlimited, but use 0 or negative number to disable it as unlimited.

        Returns:
        max messages to poll
      • isBatchAllowed

        public boolean isBatchAllowed()
        Specified by:
        isBatchAllowed in interface org.apache.camel.BatchConsumer