Package org.apache.camel.support
Class EventDrivenPollingConsumer
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.PollingConsumerSupport
-
- org.apache.camel.support.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 thePollingConsumerwhich uses the normal asynchronous consumer mechanism along with aBlockingQueueto allow the caller to pull messages on demand.
-
-
Constructor Summary
Constructors Constructor Description EventDrivenPollingConsumer(org.apache.camel.Endpoint endpoint)EventDrivenPollingConsumer(org.apache.camel.Endpoint endpoint, int queueSize)EventDrivenPollingConsumer(org.apache.camel.Endpoint endpoint, BlockingQueue<org.apache.camel.Exchange> queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterPoll()protected longbeforePoll(long timeout)protected org.apache.camel.ConsumercreateConsumer()protected voiddoBuild()protected voiddoInit()protected voiddoShutdown()protected voiddoStart()protected voiddoStop()longgetBlockTimeout()protected org.apache.camel.ConsumergetConsumer()org.apache.camel.ConsumergetDelegateConsumer()org.apache.camel.spi.ExceptionHandlergetInterruptedExceptionHandler()org.apache.camel.ProcessorgetProcessor()intgetQueueCapacity()Gets the queue capacity.intgetQueueSize()Gets the current queue size (no of elements in the queue).protected voidhandleInterruptedException(InterruptedException e)booleanisBlockWhenFull()booleanisCopy()booleanisSingleton()protected org.apache.camel.ExchangeprepareCopy(org.apache.camel.Exchange exchange, boolean handover)voidprocess(org.apache.camel.Exchange exchange)org.apache.camel.Exchangereceive()org.apache.camel.Exchangereceive(long timeout)org.apache.camel.ExchangereceiveNoWait()voidsetBlockTimeout(long blockTimeout)voidsetBlockWhenFull(boolean blockWhenFull)voidsetCopy(boolean copy)voidsetInterruptedExceptionHandler(org.apache.camel.spi.ExceptionHandler interruptedExceptionHandler)-
Methods inherited from class org.apache.camel.support.PollingConsumerSupport
createExchange, getEndpoint, getExceptionHandler, handleException, releaseExchange, setExceptionHandler, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, doResume, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
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:
getProcessorin interfaceorg.apache.camel.Consumer- Overrides:
getProcessorin classPollingConsumerSupport
-
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:
receiveNoWaitin interfaceorg.apache.camel.PollingConsumer
-
receive
public org.apache.camel.Exchange receive()
- Specified by:
receivein interfaceorg.apache.camel.PollingConsumer
-
receive
public org.apache.camel.Exchange receive(long timeout)
- Specified by:
receivein interfaceorg.apache.camel.PollingConsumer
-
process
public void process(org.apache.camel.Exchange exchange) throws Exception- Specified by:
processin interfaceorg.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:
doBuildin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doInit
protected void doInit() throws Exception- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doShutdown
protected void doShutdown() throws Exception- Overrides:
doShutdownin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingletonin interfaceorg.apache.camel.IsSingleton
-
-