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 thePollingConsumer
which uses the normal asynchronous consumer mechanism along with aBlockingQueue
to 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 void
afterPoll()
protected long
beforePoll(long timeout)
protected org.apache.camel.Consumer
createConsumer()
protected void
doBuild()
protected void
doInit()
protected void
doShutdown()
protected void
doStart()
protected void
doStop()
long
getBlockTimeout()
protected org.apache.camel.Consumer
getConsumer()
org.apache.camel.Consumer
getDelegateConsumer()
org.apache.camel.spi.ExceptionHandler
getInterruptedExceptionHandler()
org.apache.camel.Processor
getProcessor()
int
getQueueCapacity()
Gets the queue capacity.int
getQueueSize()
Gets the current queue size (no of elements in the queue).protected void
handleInterruptedException(InterruptedException e)
boolean
isBlockWhenFull()
boolean
isCopy()
boolean
isSingleton()
protected org.apache.camel.Exchange
prepareCopy(org.apache.camel.Exchange exchange, boolean handover)
void
process(org.apache.camel.Exchange exchange)
org.apache.camel.Exchange
receive()
org.apache.camel.Exchange
receive(long timeout)
org.apache.camel.Exchange
receiveNoWait()
void
setBlockTimeout(long blockTimeout)
void
setBlockWhenFull(boolean blockWhenFull)
void
setCopy(boolean copy)
void
setInterruptedExceptionHandler(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:
getProcessor
in interfaceorg.apache.camel.Consumer
- Overrides:
getProcessor
in 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:
receiveNoWait
in interfaceorg.apache.camel.PollingConsumer
-
receive
public org.apache.camel.Exchange receive()
- Specified by:
receive
in interfaceorg.apache.camel.PollingConsumer
-
receive
public org.apache.camel.Exchange receive(long timeout)
- Specified by:
receive
in interfaceorg.apache.camel.PollingConsumer
-
process
public void process(org.apache.camel.Exchange exchange) throws Exception
- Specified by:
process
in 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:
doBuild
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doInit
protected void doInit() throws Exception
- Overrides:
doInit
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doShutdown
protected void doShutdown() throws Exception
- Overrides:
doShutdown
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interfaceorg.apache.camel.IsSingleton
-
-