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

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected BlockingQueueFactory<org.apache.camel.Exchange>
     
    protected final org.slf4j.Logger
     
    protected final int
     
    protected int
     

    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

    Constructors
    Constructor
    Description
     
  • Method Summary

    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
     
    int
     
    long
     
    int
     
    BlockingQueueFactory<org.apache.camel.Exchange>
     
    getOrCreateQueue(SedaEndpoint endpoint, Integer size, Boolean multipleConsumers, BlockingQueueFactory<org.apache.camel.Exchange> customQueueFactory)
     
     
     
     
    int
     
    boolean
     
    boolean
    Whether a thread that sends messages to a full SEDA queue will be discarded.
    registerQueue(SedaEndpoint endpoint, BlockingQueue<org.apache.camel.Exchange> queue)
     
    void
    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
    setDefaultPollTimeout(int defaultPollTimeout)
    The timeout (in milliseconds) used when polling.
    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, 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, doStart, 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

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods 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") protected int concurrentConsumers
    • queueSize

      @Metadata(label="advanced", defaultValue="1000") protected int queueSize
    • defaultQueueFactory

      @Metadata(label="advanced") 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

      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:
      createEndpoint in class org.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

      public String getQueueKey(String uri)
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
      Throws:
      Exception