Class EventDrivenPollingConsumer

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.Consumer, org.apache.camel.EndpointAware, org.apache.camel.IsSingleton, org.apache.camel.PollingConsumer, org.apache.camel.Processor, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    public class EventDrivenPollingConsumer
    extends PollingConsumerSupport
    implements org.apache.camel.Processor, org.apache.camel.IsSingleton
    A default implementation of the PollingConsumer which uses the normal asynchronous consumer mechanism along with a BlockingQueue to allow the caller to pull messages on demand.
    • Constructor Detail

      • EventDrivenPollingConsumer

        public EventDrivenPollingConsumer​(org.apache.camel.Endpoint endpoint)
      • EventDrivenPollingConsumer

        public EventDrivenPollingConsumer​(org.apache.camel.Endpoint endpoint,
                                          int queueSize)
      • EventDrivenPollingConsumer

        public EventDrivenPollingConsumer​(org.apache.camel.Endpoint endpoint,
                                          BlockingQueue<org.apache.camel.Exchange> queue)
    • Method Detail

      • getProcessor

        public org.apache.camel.Processor getProcessor()
        Specified by:
        getProcessor in interface org.apache.camel.Consumer
        Overrides:
        getProcessor in class PollingConsumerSupport
      • isBlockWhenFull

        public boolean isBlockWhenFull()
      • setBlockWhenFull

        public void setBlockWhenFull​(boolean blockWhenFull)
      • getBlockTimeout

        public long getBlockTimeout()
      • setBlockTimeout

        public void setBlockTimeout​(long blockTimeout)
      • isCopy

        public boolean isCopy()
      • setCopy

        public void setCopy​(boolean copy)
      • getQueueCapacity

        public int getQueueCapacity()
        Gets the queue capacity.
      • getQueueSize

        public int getQueueSize()
        Gets the current queue size (no of elements in the queue).
      • receiveNoWait

        public org.apache.camel.Exchange receiveNoWait()
        Specified by:
        receiveNoWait in interface org.apache.camel.PollingConsumer
      • receive

        public org.apache.camel.Exchange receive()
        Specified by:
        receive in interface org.apache.camel.PollingConsumer
      • receive

        public org.apache.camel.Exchange receive​(long timeout)
        Specified by:
        receive in interface org.apache.camel.PollingConsumer
      • process

        public void process​(org.apache.camel.Exchange exchange)
                     throws Exception
        Specified by:
        process in interface org.apache.camel.Processor
        Throws:
        Exception
      • prepareCopy

        protected org.apache.camel.Exchange prepareCopy​(org.apache.camel.Exchange exchange,
                                                        boolean handover)
      • getInterruptedExceptionHandler

        public org.apache.camel.spi.ExceptionHandler getInterruptedExceptionHandler()
      • setInterruptedExceptionHandler

        public void setInterruptedExceptionHandler​(org.apache.camel.spi.ExceptionHandler interruptedExceptionHandler)
      • getDelegateConsumer

        public org.apache.camel.Consumer getDelegateConsumer()
      • handleInterruptedException

        protected void handleInterruptedException​(InterruptedException e)
      • beforePoll

        protected long beforePoll​(long timeout)
      • afterPoll

        protected void afterPoll()
      • getConsumer

        protected org.apache.camel.Consumer getConsumer()
      • createConsumer

        protected org.apache.camel.Consumer createConsumer()
                                                    throws Exception
        Throws:
        Exception
      • doBuild

        protected void doBuild()
                        throws Exception
        Overrides:
        doBuild in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doInit

        protected void doInit()
                       throws Exception
        Overrides:
        doInit in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doStop

        protected void doStop()
                       throws Exception
        Overrides:
        doStop in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doShutdown

        protected void doShutdown()
                           throws Exception
        Overrides:
        doShutdown in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • isSingleton

        public boolean isSingleton()
        Specified by:
        isSingleton in interface org.apache.camel.IsSingleton