@ManagedResource(description="Managed SedaEndpoint") @UriEndpoint(firstVersion="1.1.0", scheme="seda", title="SEDA", syntax="seda:name", consumerClass=SedaConsumer.class, label="core,endpoint") public class SedaEndpoint extends DefaultEndpoint implements AsyncEndpoint, BrowsableEndpoint, MultipleConsumersSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
SedaEndpoint() |
SedaEndpoint(String endpointUri,
Component component,
BlockingQueue<Exchange> queue) |
SedaEndpoint(String endpointUri,
Component component,
BlockingQueue<Exchange> queue,
int concurrentConsumers) |
SedaEndpoint(String endpointUri,
Component component,
BlockingQueueFactory<Exchange> queueFactory,
int concurrentConsumers) |
Modifier and Type | Method and Description |
---|---|
Consumer |
createConsumer(Processor processor)
Creates a new Event
Driven Consumer which consumes messages from the endpoint using the
given processor
|
protected SedaConsumer |
createNewConsumer(Processor processor) |
PollingConsumer |
createPollingConsumer()
Creates a new Polling
Consumer so that the caller can poll message exchanges from the
consumer using
PollingConsumer.receive() ,
PollingConsumer.receiveNoWait() or
PollingConsumer.receive(long) whenever it is ready to do so
rather than using the Event
Based Consumer returned by Endpoint.createConsumer(Processor) |
Producer |
createProducer()
Creates a new producer which is used send messages into the endpoint
|
protected BlockingQueue<Exchange> |
createQueue() |
protected void |
doShutdown()
Implementations override this method to perform customized shutdown.
|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
SedaComponent |
getComponent()
Returns the component that created this endpoint.
|
int |
getConcurrentConsumers() |
protected MulticastProcessor |
getConsumerMulticastProcessor() |
Set<SedaConsumer> |
getConsumers()
Returns the current active consumers on this endpoint
|
int |
getCurrentQueueSize() |
List<Exchange> |
getExchanges()
Returns the current pending exchanges
|
long |
getOfferTimeout() |
int |
getPollTimeout() |
Set<SedaProducer> |
getProducers()
Returns the current active producers on this endpoint
|
BlockingQueue<Exchange> |
getQueue() |
QueueReference |
getQueueReference()
Get's the
QueueReference for the this endpoint. |
int |
getSize() |
long |
getTimeout() |
WaitForTaskToComplete |
getWaitForTaskToComplete() |
boolean |
hasConsumers() |
boolean |
isBlockWhenFull() |
boolean |
isDiscardIfNoConsumers() |
boolean |
isFailIfNoConsumers() |
boolean |
isLimitConcurrentConsumers() |
boolean |
isMultipleConsumers() |
boolean |
isMultipleConsumersSupported()
Are multiple consumers supported?
|
boolean |
isPurgeWhenStopping() |
boolean |
isSingleton()
Whether this class supports being singleton or not.
|
void |
purgeQueue()
Purges the queue
|
void |
setBlockWhenFull(boolean blockWhenFull)
Whether a thread that sends messages to a full SEDA queue will block until the queue's capacity is no longer exhausted.
|
void |
setConcurrentConsumers(int concurrentConsumers)
Number of concurrent threads processing exchanges.
|
void |
setDiscardIfNoConsumers(boolean discardIfNoConsumers)
Whether the producer should discard the message (do not add the message to the queue), when sending to a queue with no active consumers.
|
void |
setFailIfNoConsumers(boolean failIfNoConsumers)
Whether the producer should fail by throwing an exception, when sending to a queue with no active consumers.
|
void |
setLimitConcurrentConsumers(boolean limitConcurrentConsumers)
Whether to limit the number of concurrentConsumers to the maximum of 500.
|
void |
setMultipleConsumers(boolean multipleConsumers)
Specifies whether multiple consumers are allowed.
|
void |
setOfferTimeout(long offerTimeout)
offerTimeout (in milliseconds) can be added to the block case when queue is full.
|
void |
setPollTimeout(int pollTimeout)
The timeout used when polling.
|
void |
setPurgeWhenStopping(boolean purgeWhenStopping)
Whether to purge the task queue when stopping the consumer/route.
|
void |
setQueue(BlockingQueue<Exchange> queue)
Define the queue instance which will be used by the endpoint.
|
void |
setSize(int size)
The maximum capacity of the SEDA queue (i.e., the number of messages it can hold).
|
void |
setTimeout(long timeout)
Timeout (in milliseconds) before a SEDA producer will stop waiting for an asynchronous task to complete.
|
void |
setWaitForTaskToComplete(WaitForTaskToComplete waitForTaskToComplete)
Option to specify whether the caller should wait for the async task to complete or not before continuing.
|
void |
shutdown()
Shutdown the service, which means it cannot be started again.
|
void |
stop()
Stops the service
|
protected void |
updateMulticastProcessor() |
configureConsumer, configurePollingConsumer, configureProperties, createEndpointConfiguration, createEndpointUri, createExchange, createExchange, createExchange, doStop, equals, getCamelContext, getConsumerProperties, getEndpointConfiguration, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isBridgeErrorHandler, isLenientProperties, isPollingConsumerBlockWhenFull, isSynchronous, setBridgeErrorHandler, setCamelContext, setConsumerProperties, setEndpointConfiguration, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, start, suspend
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
configureProperties, createExchange, createExchange, createExchange, getCamelContext, getEndpointConfiguration, getEndpointKey, getEndpointUri, isLenientProperties, setCamelContext
public SedaEndpoint()
public SedaEndpoint(String endpointUri, Component component, BlockingQueue<Exchange> queue)
public SedaEndpoint(String endpointUri, Component component, BlockingQueue<Exchange> queue, int concurrentConsumers)
public SedaEndpoint(String endpointUri, Component component, BlockingQueueFactory<Exchange> queueFactory, int concurrentConsumers)
public SedaComponent getComponent()
DefaultEndpoint
getComponent
in class DefaultEndpoint
public Producer createProducer() throws Exception
Endpoint
createProducer
in interface Endpoint
Exception
- can be thrownpublic Consumer createConsumer(Processor processor) throws Exception
Endpoint
createConsumer
in interface Endpoint
processor
- the given processorException
- can be thrownprotected SedaConsumer createNewConsumer(Processor processor)
public PollingConsumer createPollingConsumer() throws Exception
Endpoint
PollingConsumer.receive()
,
PollingConsumer.receiveNoWait()
or
PollingConsumer.receive(long)
whenever it is ready to do so
rather than using the Event
Based Consumer returned by Endpoint.createConsumer(Processor)
createPollingConsumer
in interface Endpoint
createPollingConsumer
in class DefaultEndpoint
Exception
- if the pull consumer could not be createdpublic BlockingQueue<Exchange> getQueue()
protected BlockingQueue<Exchange> createQueue()
public QueueReference getQueueReference()
QueueReference
for the this endpoint.protected MulticastProcessor getConsumerMulticastProcessor() throws Exception
Exception
protected void updateMulticastProcessor() throws Exception
Exception
public void setQueue(BlockingQueue<Exchange> queue)
@ManagedAttribute(description="Queue max capacity") public int getSize()
public void setSize(int size)
@ManagedAttribute(description="Current queue size") public int getCurrentQueueSize()
public void setBlockWhenFull(boolean blockWhenFull)
@ManagedAttribute(description="Whether the caller will block sending to a full queue") public boolean isBlockWhenFull()
public void setConcurrentConsumers(int concurrentConsumers)
@ManagedAttribute(description="Number of concurrent consumers") public int getConcurrentConsumers()
@ManagedAttribute public boolean isLimitConcurrentConsumers()
public void setLimitConcurrentConsumers(boolean limitConcurrentConsumers)
public WaitForTaskToComplete getWaitForTaskToComplete()
public void setWaitForTaskToComplete(WaitForTaskToComplete waitForTaskToComplete)
@ManagedAttribute public long getTimeout()
public void setTimeout(long timeout)
@ManagedAttribute public long getOfferTimeout()
public void setOfferTimeout(long offerTimeout)
@ManagedAttribute public boolean isFailIfNoConsumers()
public void setFailIfNoConsumers(boolean failIfNoConsumers)
@ManagedAttribute public boolean isDiscardIfNoConsumers()
public void setDiscardIfNoConsumers(boolean discardIfNoConsumers)
@ManagedAttribute public boolean isMultipleConsumers()
public void setMultipleConsumers(boolean multipleConsumers)
@ManagedAttribute public int getPollTimeout()
public void setPollTimeout(int pollTimeout)
@ManagedAttribute public boolean isPurgeWhenStopping()
public void setPurgeWhenStopping(boolean purgeWhenStopping)
public boolean isSingleton()
IsSingleton
isSingleton
in interface IsSingleton
public List<Exchange> getExchanges()
getExchanges
in interface BrowsableEndpoint
@ManagedAttribute public boolean isMultipleConsumersSupported()
MultipleConsumersSupport
isMultipleConsumersSupported
in interface MultipleConsumersSupport
@ManagedOperation(description="Purges the seda queue") public void purgeQueue()
public Set<SedaConsumer> getConsumers()
public Set<SedaProducer> getProducers()
public boolean hasConsumers()
protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class DefaultEndpoint
Exception
ServiceSupport.doStop()
public void stop() throws Exception
Service
stop
in interface Service
stop
in class ServiceSupport
Exception
- is thrown if stopping failedpublic void shutdown() throws Exception
ShutdownableService
shutdown
in interface ShutdownableService
shutdown
in class ServiceSupport
Exception
- thrown if shutting down failedprotected void doShutdown() throws Exception
ServiceSupport
doShutdown
in class ServiceSupport
Exception
Apache Camel