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 voidprotected longbeforePoll(long timeout) protected org.apache.camel.Consumerprotected voiddoBuild()protected voiddoInit()protected voidprotected voiddoStart()protected voiddoStop()longprotected org.apache.camel.Consumerorg.apache.camel.Consumerorg.apache.camel.spi.ExceptionHandlerorg.apache.camel.ProcessorintGets the queue capacity.intGets the current queue size (no of elements in the queue).protected voidbooleanbooleanisCopy()booleanprotected 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.ExchangevoidsetBlockTimeout(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, toStringMethods 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, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Consumer
defaultConsumerCallbackMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods 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:
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
- 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
-
beforePoll
protected long beforePoll(long timeout) -
afterPoll
protected void afterPoll() -
getConsumer
protected org.apache.camel.Consumer getConsumer() -
createConsumer
- Throws:
Exception
-
doBuild
- Overrides:
doBuildin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doShutdown
- Overrides:
doShutdownin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
isSingleton
public boolean isSingleton()- Specified by:
isSingletonin interfaceorg.apache.camel.IsSingleton
-