Package org.apache.camel.component.seda
Class SedaComponent
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultComponent
org.apache.camel.component.seda.SedaComponent
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Component,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasCamelContext,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@Component("seda")
public class SedaComponent
extends org.apache.camel.support.DefaultComponent
The SEDA Component is for asynchronous SEDA exchanges on a
BlockingQueue within a CamelContext-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected BlockingQueueFactory<org.apache.camel.Exchange> protected final org.slf4j.Loggerprotected final intprotected intFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.camel.Endpointprotected SedaEndpointcreateEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueue<org.apache.camel.Exchange> queue, int concurrentConsumers) protected SedaEndpointcreateEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueueFactory<org.apache.camel.Exchange> queueFactory, int concurrentConsumers) protected voiddoStop()intlongintBlockingQueueFactory<org.apache.camel.Exchange> getOrCreateQueue(SedaEndpoint endpoint, Integer size, Boolean multipleConsumers, BlockingQueueFactory<org.apache.camel.Exchange> customQueueFactory) getQueueKey(String uri) getQueueReference(String key) intbooleanbooleanWhether a thread that sends messages to a full SEDA queue will be discarded.registerQueue(SedaEndpoint endpoint, BlockingQueue<org.apache.camel.Exchange> queue) voidsetConcurrentConsumers(int size) Sets the default number of concurrent threads processing exchanges.voidsetDefaultBlockWhenFull(boolean defaultBlockWhenFull) Whether a thread that sends messages to a full SEDA queue will block until the queue's capacity is no longer exhausted.voidsetDefaultDiscardWhenFull(boolean defaultDiscardWhenFull) voidsetDefaultOfferTimeout(long defaultOfferTimeout) Whether a thread that sends messages to a full SEDA queue will block until the queue's capacity is no longer exhausted.voidsetDefaultPollTimeout(int defaultPollTimeout) The timeout (in milliseconds) used when polling.voidsetDefaultQueueFactory(BlockingQueueFactory<org.apache.camel.Exchange> defaultQueueFactory) Sets the default queue factory.voidsetQueueSize(int size) Sets the default maximum capacity of the SEDA queue (i.e., the number of messages it can hold).Methods inherited from class org.apache.camel.support.DefaultComponent
afterConfiguration, createEndpoint, createEndpoint, doBuild, doInit, getAndRemoveOrResolveReferenceParameter, getAndRemoveOrResolveReferenceParameter, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, getComponentPropertyConfigurer, getDefaultName, getEndpointPropertyConfigurer, getExtension, getSupportedExtensions, ifStartsWithReturnRemainder, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, registerExtension, registerExtension, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, resolveRawParameterValues, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setLazyStartProducer, setProperties, setProperties, setProperties, useIntrospectionOnEndpoint, useRawUri, validateParameters, validateURIMethods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, doResume, doShutdown, doStart, doSuspend, fail, getInternalLock, 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, toString, wait, wait, waitMethods 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
-
Field Details
-
log
protected final org.slf4j.Logger log -
maxConcurrentConsumers
protected final int maxConcurrentConsumers- See Also:
-
concurrentConsumers
@Metadata(label="consumer", defaultValue="1", description="Sets the default number of concurrent threads processing exchanges.") protected int concurrentConsumers -
queueSize
@Metadata(label="advanced", defaultValue="1000", description="Sets the default maximum capacity of the SEDA queue (i.e., the number of messages it can hold).") protected int queueSize -
defaultQueueFactory
@Metadata(label="advanced", description="Sets the default queue factory.") protected BlockingQueueFactory<org.apache.camel.Exchange> defaultQueueFactory
-
-
Constructor Details
-
SedaComponent
public SedaComponent()
-
-
Method Details
-
setQueueSize
public void setQueueSize(int size) Sets the default maximum capacity of the SEDA queue (i.e., the number of messages it can hold). -
getQueueSize
public int getQueueSize() -
setConcurrentConsumers
public void setConcurrentConsumers(int size) Sets the default number of concurrent threads processing exchanges. -
getConcurrentConsumers
public int getConcurrentConsumers() -
getDefaultQueueFactory
-
setDefaultQueueFactory
public void setDefaultQueueFactory(BlockingQueueFactory<org.apache.camel.Exchange> defaultQueueFactory) Sets the default queue factory. -
isDefaultBlockWhenFull
public boolean isDefaultBlockWhenFull() -
setDefaultBlockWhenFull
public void setDefaultBlockWhenFull(boolean defaultBlockWhenFull) Whether a thread that sends messages to a full SEDA queue will block until the queue's capacity is no longer exhausted. By default, an exception will be thrown stating that the queue is full. By enabling this option, the calling thread will instead block and wait until the message can be accepted. -
isDefaultDiscardWhenFull
public boolean isDefaultDiscardWhenFull()Whether a thread that sends messages to a full SEDA queue will be discarded. By default, an exception will be thrown stating that the queue is full. By enabling this option, the calling thread will give up sending and continue, meaning that the message was not sent to the SEDA queue. -
setDefaultDiscardWhenFull
public void setDefaultDiscardWhenFull(boolean defaultDiscardWhenFull) -
getDefaultOfferTimeout
public long getDefaultOfferTimeout() -
setDefaultOfferTimeout
public void setDefaultOfferTimeout(long defaultOfferTimeout) Whether a thread that sends messages to a full SEDA queue will block until the queue's capacity is no longer exhausted. By default, an exception will be thrown stating that the queue is full. By enabling this option, where a configured timeout can be added to the block case. Using the .offer(timeout) method of the underlining java queue -
getDefaultPollTimeout
public int getDefaultPollTimeout() -
setDefaultPollTimeout
public void setDefaultPollTimeout(int defaultPollTimeout) The timeout (in milliseconds) used when polling. When a timeout occurs, the consumer can check whether it is allowed to continue running. Setting a lower value allows the consumer to react more quickly upon shutdown. -
getOrCreateQueue
public QueueReference getOrCreateQueue(SedaEndpoint endpoint, Integer size, Boolean multipleConsumers, BlockingQueueFactory<org.apache.camel.Exchange> customQueueFactory) -
registerQueue
public QueueReference registerQueue(SedaEndpoint endpoint, BlockingQueue<org.apache.camel.Exchange> queue) -
getQueues
-
getQueueReference
-
createEndpoint
protected org.apache.camel.Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception- Specified by:
createEndpointin classorg.apache.camel.support.DefaultComponent- Throws:
Exception
-
createEndpoint
protected SedaEndpoint createEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueueFactory<org.apache.camel.Exchange> queueFactory, int concurrentConsumers) -
createEndpoint
protected SedaEndpoint createEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueue<org.apache.camel.Exchange> queue, int concurrentConsumers) -
getQueueKey
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-