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.StatefulService,org.apache.camel.SuspendableService
@Component("seda") public class SedaComponent extends org.apache.camel.support.DefaultComponentThe SEDA Component is for asynchronous SEDA exchanges on aBlockingQueuewithin a CamelContext
-
-
Field Summary
Fields Modifier and Type Field Description protected intconcurrentConsumersprotected BlockingQueueFactory<org.apache.camel.Exchange>defaultQueueFactoryprotected org.slf4j.Loggerlogprotected intmaxConcurrentConsumersprotected intqueueSize
-
Constructor Summary
Constructors Constructor Description SedaComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.camel.EndpointcreateEndpoint(String uri, String remaining, Map<String,Object> parameters)protected 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()intgetConcurrentConsumers()longgetDefaultOfferTimeout()intgetDefaultPollTimeout()BlockingQueueFactory<org.apache.camel.Exchange>getDefaultQueueFactory()QueueReferencegetOrCreateQueue(SedaEndpoint endpoint, Integer size, Boolean multipleConsumers, BlockingQueueFactory<org.apache.camel.Exchange> customQueueFactory)StringgetQueueKey(String uri)QueueReferencegetQueueReference(String key)Map<String,QueueReference>getQueues()intgetQueueSize()booleanisDefaultBlockWhenFull()booleanisDefaultDiscardWhenFull()Whether a thread that sends messages to a full SEDA queue will be discarded.QueueReferenceregisterQueue(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, doStart, 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, validateURI
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, doResume, doShutdown, 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, toString, wait, wait, wait
-
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
maxConcurrentConsumers
protected final int maxConcurrentConsumers
- See Also:
- Constant Field Values
-
concurrentConsumers
@Metadata(label="consumer", defaultValue="1") protected int concurrentConsumers
-
queueSize
@Metadata(label="advanced", defaultValue="1000") protected int queueSize
-
defaultQueueFactory
@Metadata(label="advanced") protected BlockingQueueFactory<org.apache.camel.Exchange> defaultQueueFactory
-
-
Method Detail
-
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
public BlockingQueueFactory<org.apache.camel.Exchange> 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. Utilizing 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
public Map<String,QueueReference> getQueues()
-
getQueueReference
public QueueReference getQueueReference(String key)
-
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)
-
-