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 the
PollingConsumer
which uses the normal asynchronous consumer
mechanism along with a BlockingQueue
to allow the caller to pull messages on demand.-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
ConstructorsConstructorDescriptionEventDrivenPollingConsumer
(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
Modifier and TypeMethodDescriptionprotected void
protected long
beforePoll
(long timeout) protected org.apache.camel.Consumer
protected void
doBuild()
protected void
doInit()
protected void
protected void
doStart()
protected void
doStop()
long
protected org.apache.camel.Consumer
org.apache.camel.Consumer
org.apache.camel.spi.ExceptionHandler
org.apache.camel.Processor
int
Gets the queue capacity.int
Gets the current queue size (no of elements in the queue).protected void
boolean
boolean
isCopy()
boolean
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
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
Methods inherited from interface org.apache.camel.Consumer
defaultConsumerCallback
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
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 Details
-
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
- 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
-
beforePoll
protected long beforePoll(long timeout) -
afterPoll
protected void afterPoll() -
getConsumer
protected org.apache.camel.Consumer getConsumer() -
createConsumer
- Throws:
Exception
-
doBuild
- Overrides:
doBuild
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doInit
- Overrides:
doInit
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStart
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doShutdown
- Overrides:
doShutdown
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
isSingleton
public boolean isSingleton()- Specified by:
isSingleton
in interfaceorg.apache.camel.IsSingleton
-