org.apache.camel.component.seda
Class SedaEndpoint

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.impl.DefaultEndpoint
          extended by org.apache.camel.component.seda.SedaEndpoint
All Implemented Interfaces:
CamelContextAware, Endpoint, IsSingleton, MultipleConsumersSupport, Service, ShutdownableService, BrowsableEndpoint, HasId, StatefulService, SuspendableService

@ManagedResource(description="Managed SedaEndpoint")
@UriEndpoint(scheme="seda",
             consumerClass=SedaConsumer.class)
public class SedaEndpoint
extends DefaultEndpoint
implements BrowsableEndpoint, MultipleConsumersSupport

An implementation of the Queue components for asynchronous SEDA exchanges on a BlockingQueue within a CamelContext


Field Summary
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
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)
           
 
Method Summary
 String browseAllMessagesAsXml(Boolean includeBody)
           
 String browseExchange(Integer index)
           
 String browseMessageAsXml(Integer index, Boolean includeBody)
           
 String browseMessageBody(Integer index)
           
 String browseRangeMessagesAsXml(Integer fromIndex, Integer toIndex, Boolean includeBody)
           
 Consumer createConsumer(Processor processor)
          Creates a new Event Driven Consumer which consumes messages from the endpoint using the given 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.
 String getCamelId()
           
 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()
           
 String getEndpointUri()
          Returns the string representation of the endpoint URI
 List<Exchange> getExchanges()
          Returns the current pending exchanges
 int getPollTimeout()
           
 Set<SedaProducer> getProducers()
          Returns the current active producers on this endpoint
 BlockingQueue<Exchange> getQueue()
           
 QueueReference getQueueReference()
           
 int getSize()
           
 String getState()
           
 long getTimeout()
           
 WaitForTaskToComplete getWaitForTaskToComplete()
           
 boolean hasConsumers()
           
 boolean isBlockWhenFull()
           
 boolean isFailIfNoConsumers()
           
 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
 long queueSize()
           
 void setBlockWhenFull(boolean blockWhenFull)
           
 void setConcurrentConsumers(int concurrentConsumers)
           
 void setFailIfNoConsumers(boolean failIfNoConsumers)
           
 void setMultipleConsumers(boolean multipleConsumers)
           
 void setPollTimeout(int pollTimeout)
           
 void setPurgeWhenStopping(boolean purgeWhenStopping)
           
 void setQueue(BlockingQueue<Exchange> queue)
           
 void setSize(int size)
           
 void setTimeout(long timeout)
           
 void setWaitForTaskToComplete(WaitForTaskToComplete waitForTaskToComplete)
           
 void shutdown()
          Shutdown the service, which means it cannot be started again.
 void stop()
          Stops the service
protected  void updateMulticastProcessor()
           
 
Methods inherited from class org.apache.camel.impl.DefaultEndpoint
configureConsumer, configurePollingConsumer, configureProperties, createEndpointConfiguration, createEndpointUri, createExchange, createExchange, createExchange, doStop, equals, getCamelContext, getConsumerProperties, getEndpointConfiguration, getEndpointKey, getExchangePattern, getId, hashCode, isLenientProperties, isSynchronous, setCamelContext, setConsumerProperties, setEndpointConfiguration, setEndpointUri, setEndpointUriIfNotSpecified, setExchangePattern, setProperties, setSynchronous, toString
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, start, suspend
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.camel.Endpoint
configureProperties, createExchange, createExchange, createExchange, getCamelContext, getEndpointConfiguration, getEndpointKey, isLenientProperties, setCamelContext
 
Methods inherited from interface org.apache.camel.Service
start
 

Constructor Detail

SedaEndpoint

public SedaEndpoint()

SedaEndpoint

public SedaEndpoint(String endpointUri,
                    Component component,
                    BlockingQueue<Exchange> queue)

SedaEndpoint

public SedaEndpoint(String endpointUri,
                    Component component,
                    BlockingQueue<Exchange> queue,
                    int concurrentConsumers)

SedaEndpoint

public SedaEndpoint(String endpointUri,
                    Component component,
                    BlockingQueueFactory<Exchange> queueFactory,
                    int concurrentConsumers)
Method Detail

getComponent

public SedaComponent getComponent()
Description copied from class: DefaultEndpoint
Returns the component that created this endpoint.

Overrides:
getComponent in class DefaultEndpoint
Returns:
the component that created this endpoint, or null if none set

createProducer

public Producer createProducer()
                        throws Exception
Description copied from interface: Endpoint
Creates a new producer which is used send messages into the endpoint

Specified by:
createProducer in interface Endpoint
Returns:
a newly created producer
Throws:
Exception - can be thrown

createConsumer

public Consumer createConsumer(Processor processor)
                        throws Exception
Description copied from interface: Endpoint
Creates a new Event Driven Consumer which consumes messages from the endpoint using the given processor

Specified by:
createConsumer in interface Endpoint
Parameters:
processor - the given processor
Returns:
a newly created consumer
Throws:
Exception - can be thrown

createPollingConsumer

public PollingConsumer createPollingConsumer()
                                      throws Exception
Description copied from interface: Endpoint
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)

Specified by:
createPollingConsumer in interface Endpoint
Overrides:
createPollingConsumer in class DefaultEndpoint
Returns:
a newly created pull consumer
Throws:
Exception - if the pull consumer could not be created

getQueue

public BlockingQueue<Exchange> getQueue()

createQueue

protected BlockingQueue<Exchange> createQueue()

getQueueReference

public QueueReference getQueueReference()

getConsumerMulticastProcessor

protected MulticastProcessor getConsumerMulticastProcessor()
                                                    throws Exception
Throws:
Exception

updateMulticastProcessor

protected void updateMulticastProcessor()
                                 throws Exception
Throws:
Exception

setQueue

public void setQueue(BlockingQueue<Exchange> queue)

getSize

@ManagedAttribute(description="Queue max capacity")
public int getSize()

setSize

public void setSize(int size)

getCurrentQueueSize

@ManagedAttribute(description="Current queue size")
public int getCurrentQueueSize()

setBlockWhenFull

public void setBlockWhenFull(boolean blockWhenFull)

isBlockWhenFull

@ManagedAttribute(description="Whether the caller will block sending to a full queue")
public boolean isBlockWhenFull()

setConcurrentConsumers

public void setConcurrentConsumers(int concurrentConsumers)

getConcurrentConsumers

@ManagedAttribute(description="Number of concurrent consumers")
public int getConcurrentConsumers()

getWaitForTaskToComplete

public WaitForTaskToComplete getWaitForTaskToComplete()

setWaitForTaskToComplete

public void setWaitForTaskToComplete(WaitForTaskToComplete waitForTaskToComplete)

getTimeout

@ManagedAttribute
public long getTimeout()

setTimeout

public void setTimeout(long timeout)

isFailIfNoConsumers

@ManagedAttribute
public boolean isFailIfNoConsumers()

setFailIfNoConsumers

public void setFailIfNoConsumers(boolean failIfNoConsumers)

isMultipleConsumers

@ManagedAttribute
public boolean isMultipleConsumers()

setMultipleConsumers

public void setMultipleConsumers(boolean multipleConsumers)

getPollTimeout

@ManagedAttribute
public int getPollTimeout()

setPollTimeout

public void setPollTimeout(int pollTimeout)

isPurgeWhenStopping

@ManagedAttribute
public boolean isPurgeWhenStopping()

setPurgeWhenStopping

public void setPurgeWhenStopping(boolean purgeWhenStopping)

isSingleton

@ManagedAttribute(description="Singleton")
public boolean isSingleton()
Description copied from interface: IsSingleton
Whether this class supports being singleton or not.

Specified by:
isSingleton in interface IsSingleton
Returns:
true to be a single shared instance, false to create new instances.

getExchanges

public List<Exchange> getExchanges()
Returns the current pending exchanges

Specified by:
getExchanges in interface BrowsableEndpoint
Returns:
the exchanges on this endpoint

isMultipleConsumersSupported

@ManagedAttribute
public boolean isMultipleConsumersSupported()
Description copied from interface: MultipleConsumersSupport
Are multiple consumers supported?

Specified by:
isMultipleConsumersSupported in interface MultipleConsumersSupport
Returns:
true if multiple consumers are supported

purgeQueue

@ManagedOperation(description="Purges the seda queue")
public void purgeQueue()
Purges the queue


getConsumers

public Set<SedaConsumer> getConsumers()
Returns the current active consumers on this endpoint


getProducers

public Set<SedaProducer> getProducers()
Returns the current active producers on this endpoint


queueSize

@ManagedOperation(description="Current number of Exchanges in Queue")
public long queueSize()

browseExchange

@ManagedOperation(description="Get Exchange from queue by index")
public String browseExchange(Integer index)

browseMessageBody

@ManagedOperation(description="Get message body from queue by index")
public String browseMessageBody(Integer index)

browseMessageAsXml

@ManagedOperation(description="Get message as XML from queue by index")
public String browseMessageAsXml(Integer index,
                                                             Boolean includeBody)

browseAllMessagesAsXml

@ManagedOperation(description="Gets all the messages as XML from the queue")
public String browseAllMessagesAsXml(Boolean includeBody)

browseRangeMessagesAsXml

@ManagedOperation(description="Gets the range of messages as XML from the queue")
public String browseRangeMessagesAsXml(Integer fromIndex,
                                                                   Integer toIndex,
                                                                   Boolean includeBody)

getCamelId

@ManagedAttribute(description="Camel context name")
public String getCamelId()

getEndpointUri

@ManagedAttribute(description="Endpoint URI",
                  mask=true)
public String getEndpointUri()
Description copied from interface: Endpoint
Returns the string representation of the endpoint URI

Specified by:
getEndpointUri in interface Endpoint
Overrides:
getEndpointUri in class DefaultEndpoint
Returns:
the endpoint URI

getState

@ManagedAttribute(description="Endpoint service state")
public String getState()

hasConsumers

public boolean hasConsumers()

doStart

protected void doStart()
                throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: See ServiceSupport.doStop() for more details.

Overrides:
doStart in class DefaultEndpoint
Throws:
Exception
See Also:
ServiceSupport.doStop()

stop

public void stop()
          throws Exception
Description copied from interface: Service
Stops the service

Specified by:
stop in interface Service
Overrides:
stop in class ServiceSupport
Throws:
Exception - is thrown if stopping failed

shutdown

public void shutdown()
              throws Exception
Description copied from interface: ShutdownableService
Shutdown the service, which means it cannot be started again.

Specified by:
shutdown in interface ShutdownableService
Overrides:
shutdown in class ServiceSupport
Throws:
Exception - thrown if shutting down failed

doShutdown

protected void doShutdown()
                   throws Exception
Description copied from class: ServiceSupport
Implementations override this method to perform customized shutdown.

Overrides:
doShutdown in class ServiceSupport
Throws:
Exception


Apache Camel