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.DefaultComponent
The SEDA Component is for asynchronous SEDA exchanges on aBlockingQueue
within a CamelContext
-
-
Field Summary
Fields Modifier and Type Field Description protected int
concurrentConsumers
protected BlockingQueueFactory<org.apache.camel.Exchange>
defaultQueueFactory
protected org.slf4j.Logger
log
protected int
maxConcurrentConsumers
protected int
queueSize
-
Constructor Summary
Constructors Constructor Description SedaComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.camel.Endpoint
createEndpoint(String uri, String remaining, Map<String,Object> parameters)
protected SedaEndpoint
createEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueue<org.apache.camel.Exchange> queue, int concurrentConsumers)
protected SedaEndpoint
createEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueueFactory<org.apache.camel.Exchange> queueFactory, int concurrentConsumers)
protected void
doStop()
int
getConcurrentConsumers()
long
getDefaultOfferTimeout()
BlockingQueueFactory<org.apache.camel.Exchange>
getDefaultQueueFactory()
QueueReference
getOrCreateQueue(SedaEndpoint endpoint, Integer size, Boolean multipleConsumers, BlockingQueueFactory<org.apache.camel.Exchange> customQueueFactory)
String
getQueueKey(String uri)
QueueReference
getQueueReference(String key)
Map<String,QueueReference>
getQueues()
int
getQueueSize()
boolean
isDefaultBlockWhenFull()
boolean
isDefaultDiscardWhenFull()
Whether a thread that sends messages to a full SEDA queue will be discarded.QueueReference
registerQueue(SedaEndpoint endpoint, BlockingQueue<org.apache.camel.Exchange> queue)
void
setConcurrentConsumers(int size)
Sets the default number of concurrent threads processing exchanges.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.void
setDefaultDiscardWhenFull(boolean defaultDiscardWhenFull)
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.void
setDefaultQueueFactory(BlockingQueueFactory<org.apache.camel.Exchange> defaultQueueFactory)
Sets the default queue factory.void
setQueueSize(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
-
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:
createEndpoint
in 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)
-
-