Package org.apache.camel.component.seda
Class SedaEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.seda.SedaEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.AsyncEndpoint,org.apache.camel.CamelContextAware,org.apache.camel.ComponentAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.MultipleConsumersSupport,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.BrowsableEndpoint,org.apache.camel.spi.HasCamelContext,org.apache.camel.spi.HasId,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@ManagedResource(description="Managed SedaEndpoint")
@UriEndpoint(firstVersion="1.1.0",
scheme="seda",
title="SEDA",
syntax="seda:name",
remote=false,
category={CORE,MESSAGING})
public class SedaEndpoint
extends org.apache.camel.support.DefaultEndpoint
implements org.apache.camel.AsyncEndpoint, org.apache.camel.spi.BrowsableEndpoint, org.apache.camel.MultipleConsumersSupport
Asynchronously call another endpoint from any Camel Context in the same JVM.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.camel.spi.BrowsableEndpoint
org.apache.camel.spi.BrowsableEndpoint.BrowseStatus -
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
ConstructorsConstructorDescriptionSedaEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueue<org.apache.camel.Exchange> queue) SedaEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueue<org.apache.camel.Exchange> queue, int concurrentConsumers) SedaEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueueFactory<org.apache.camel.Exchange> queueFactory, int concurrentConsumers) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) protected SedaConsumercreateNewConsumer(org.apache.camel.Processor processor) org.apache.camel.PollingConsumerorg.apache.camel.Producerprotected BlockingQueue<org.apache.camel.Exchange> protected voiddoInit()protected voidprotected voiddoStart()intintprotected org.apache.camel.AsyncProcessorReturns the current active consumers on this endpointintList<org.apache.camel.Exchange> Returns the current pending exchangesgetName()longintReturns the current active producers on this endpointBlockingQueue<org.apache.camel.Exchange> getQueue()Gets theQueueReferencefor this endpoint.intgetSize()longorg.apache.camel.WaitForTaskToCompletebooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisRemote()voidPurges the queuevoidsetBlockWhenFull(boolean blockWhenFull) Whether a thread that sends messages to a full SEDA queue will block until the queue's capacity is no longer exhausted.voidsetBrowseLimit(int browseLimit) voidsetConcurrentConsumers(int concurrentConsumers) Number of concurrent threads processing exchanges.voidsetDiscardIfNoConsumers(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.voidsetDiscardWhenFull(boolean discardWhenFull) Whether a thread that sends messages to a full SEDA queue will be discarded.voidsetFailIfNoConsumers(boolean failIfNoConsumers) Whether the producer should fail by throwing an exception, when sending to a queue with no active consumers.voidsetLimitConcurrentConsumers(boolean limitConcurrentConsumers) Whether to limit the number of concurrentConsumers to the maximum of 500.voidsetMultipleConsumers(boolean multipleConsumers) Specifies whether multiple consumers are allowed.voidsetOfferTimeout(long offerTimeout) Offer timeout (in milliseconds) can be added to the block case when queue is full.voidsetPollTimeout(int pollTimeout) The timeout (in milliseconds) used when polling.voidsetPurgeWhenStopping(boolean purgeWhenStopping) Whether to purge the task queue when stopping the consumer/route.voidsetQueue(BlockingQueue<org.apache.camel.Exchange> queue) Define the queue instance which will be used by the endpoint.voidsetSize(int size) The maximum capacity of the SEDA queue (i.e., the number of messages it can hold).voidsetTimeout(long timeout) Timeout (in milliseconds) before a SEDA producer will stop waiting for an asynchronous task to complete.voidsetWaitForTaskToComplete(org.apache.camel.WaitForTaskToComplete waitForTaskToComplete) Option to specify whether the caller should wait for the async task to complete or not before continuing.voidshutdown()voidstop()protected voidMethods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, equals, getCamelContext, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doStop, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, start, suspendMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.spi.BrowsableEndpoint
getBrowseStatus, getExchangesMethods inherited from interface org.apache.camel.ComponentAware
getComponent, setComponentMethods inherited from interface org.apache.camel.Endpoint
configureExchange, configureProperties, createAsyncProducer, createExchange, createExchange, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isLenientProperties, isSingletonProducer, setCamelContextMethods inherited from interface org.apache.camel.IsSingleton
isSingletonMethods inherited from interface org.apache.camel.Service
build, close, init, startMethods 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
-
SedaEndpoint
public SedaEndpoint() -
SedaEndpoint
public SedaEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueue<org.apache.camel.Exchange> queue) -
SedaEndpoint
public SedaEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueue<org.apache.camel.Exchange> queue, int concurrentConsumers) -
SedaEndpoint
public SedaEndpoint(String endpointUri, org.apache.camel.Component component, BlockingQueueFactory<org.apache.camel.Exchange> queueFactory, int concurrentConsumers)
-
-
Method Details
-
isRemote
public boolean isRemote()- Specified by:
isRemotein interfaceorg.apache.camel.Endpoint
-
getComponent
- Specified by:
getComponentin interfaceorg.apache.camel.ComponentAware- Overrides:
getComponentin classorg.apache.camel.support.DefaultEndpoint
-
createProducer
- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createNewConsumer
-
createPollingConsumer
- Specified by:
createPollingConsumerin interfaceorg.apache.camel.Endpoint- Overrides:
createPollingConsumerin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
getQueue
-
createQueue
-
getQueueReference
Gets theQueueReferencefor this endpoint.- Returns:
- the reference, or null if no queue reference exists.
-
getConsumerMulticastProcessor
protected org.apache.camel.AsyncProcessor getConsumerMulticastProcessor() -
updateMulticastProcessor
- Throws:
Exception
-
getName
-
setQueue
Define the queue instance which will be used by the endpoint. This option is only for rare use-cases where you want to use a custom queue instance. -
getSize
@ManagedAttribute(description="Queue max capacity") public int getSize() -
setSize
public void setSize(int size) The maximum capacity of the SEDA queue (i.e., the number of messages it can hold). Will by default use the defaultSize set on the SEDA component. -
getCurrentQueueSize
@ManagedAttribute(description="Current queue size") public int getCurrentQueueSize() -
getBrowseLimit
@ManagedAttribute(description="Maximum number of messages to browse by default") public int getBrowseLimit()- Specified by:
getBrowseLimitin interfaceorg.apache.camel.spi.BrowsableEndpoint
-
setBrowseLimit
public void setBrowseLimit(int browseLimit) - Specified by:
setBrowseLimitin interfaceorg.apache.camel.spi.BrowsableEndpoint
-
setBlockWhenFull
public 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. 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. -
isBlockWhenFull
@ManagedAttribute(description="Whether the caller will block sending to a full queue") public boolean isBlockWhenFull() -
setDiscardWhenFull
public void setDiscardWhenFull(boolean discardWhenFull) 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. -
isDiscardWhenFull
@ManagedAttribute(description="Whether the caller will discard sending to a full queue") public boolean isDiscardWhenFull() -
setConcurrentConsumers
public void setConcurrentConsumers(int concurrentConsumers) Number of concurrent threads processing exchanges. -
getConcurrentConsumers
@ManagedAttribute(description="Number of concurrent consumers") public int getConcurrentConsumers() -
isLimitConcurrentConsumers
@ManagedAttribute public boolean isLimitConcurrentConsumers() -
setLimitConcurrentConsumers
public void setLimitConcurrentConsumers(boolean limitConcurrentConsumers) Whether to limit the number of concurrentConsumers to the maximum of 500. By default, an exception will be thrown if an endpoint is configured with a greater number. You can disable that check by turning this option off. -
getWaitForTaskToComplete
public org.apache.camel.WaitForTaskToComplete getWaitForTaskToComplete() -
setWaitForTaskToComplete
public void setWaitForTaskToComplete(org.apache.camel.WaitForTaskToComplete waitForTaskToComplete) Option to specify whether the caller should wait for the async task to complete or not before continuing. The following three options are supported: Always, Never or IfReplyExpected. The first two values are self-explanatory. The last value, IfReplyExpected, will only wait if the message is Request Reply based. The default option is IfReplyExpected. -
getTimeout
@ManagedAttribute public long getTimeout() -
setTimeout
public void setTimeout(long timeout) Timeout (in milliseconds) before a SEDA producer will stop waiting for an asynchronous task to complete. You can disable timeout by using 0 or a negative value. -
getOfferTimeout
@ManagedAttribute public long getOfferTimeout() -
setOfferTimeout
public void setOfferTimeout(long offerTimeout) Offer timeout (in milliseconds) can be added to the block case when queue is full. You can disable timeout by using 0 or a negative value. -
isFailIfNoConsumers
@ManagedAttribute public boolean isFailIfNoConsumers() -
setFailIfNoConsumers
public void setFailIfNoConsumers(boolean failIfNoConsumers) Whether the producer should fail by throwing an exception, when sending to a queue with no active consumers. Only one of the options discardIfNoConsumers and failIfNoConsumers can be enabled at the same time. -
isDiscardIfNoConsumers
@ManagedAttribute public boolean isDiscardIfNoConsumers() -
setDiscardIfNoConsumers
public 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. Only one of the options discardIfNoConsumers and failIfNoConsumers can be enabled at the same time. -
isMultipleConsumers
@ManagedAttribute public boolean isMultipleConsumers() -
setMultipleConsumers
public void setMultipleConsumers(boolean multipleConsumers) Specifies whether multiple consumers are allowed. If enabled, you can use SEDA for Publish-Subscribe messaging. That is, you can send a message to the SEDA queue and have each consumer receive a copy of the message. When enabled, this option should be specified on every consumer endpoint. -
getPollTimeout
@ManagedAttribute public int getPollTimeout() -
setPollTimeout
public void setPollTimeout(int pollTimeout) 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. -
isPurgeWhenStopping
@ManagedAttribute public boolean isPurgeWhenStopping() -
setPurgeWhenStopping
public void setPurgeWhenStopping(boolean purgeWhenStopping) Whether to purge the task queue when stopping the consumer/route. This allows to stop faster, as any pending messages on the queue is discarded. -
getExchanges
Returns the current pending exchanges- Specified by:
getExchangesin interfaceorg.apache.camel.spi.BrowsableEndpoint
-
isMultipleConsumersSupported
@ManagedAttribute public boolean isMultipleConsumersSupported()- Specified by:
isMultipleConsumersSupportedin interfaceorg.apache.camel.MultipleConsumersSupport
-
purgeQueue
@ManagedOperation(description="Purges the seda queue") public void purgeQueue()Purges the queue -
getConsumers
Returns the current active consumers on this endpoint -
getProducers
Returns the current active producers on this endpoint -
hasConsumers
public boolean hasConsumers() -
doInit
- Overrides:
doInitin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
stop
public void stop()- Specified by:
stopin interfaceorg.apache.camel.Service- Overrides:
stopin classorg.apache.camel.support.service.BaseService
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceorg.apache.camel.ShutdownableService- Overrides:
shutdownin classorg.apache.camel.support.service.BaseService
-
doShutdown
- Overrides:
doShutdownin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-