org.springframework.integration.channel
Class PublishSubscribeChannel

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.channel.AbstractMessageChannel
          extended by org.springframework.integration.channel.AbstractSubscribableChannel
              extended by org.springframework.integration.channel.PublishSubscribeChannel
All Implemented Interfaces:
BeanFactoryAware, BeanNameAware, InitializingBean, NamedComponent, SubscribableChannel, TrackableComponent, MessageChannel

public class PublishSubscribeChannel
extends AbstractSubscribableChannel

A channel that sends Messages to each of its subscribers.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorList
 
Field Summary
 
Fields inherited from class org.springframework.integration.channel.AbstractMessageChannel
logger
 
Constructor Summary
PublishSubscribeChannel()
          Create a PublishSubscribeChannel that will invoke the handlers in the message sender's thread.
PublishSubscribeChannel(java.util.concurrent.Executor executor)
          Create a PublishSubscribeChannel that will use an Executor to invoke the handlers.
 
Method Summary
 java.lang.String getComponentType()
          Subclasses may implement this method to provide component type information.
protected  BroadcastingDispatcher getDispatcher()
           
 void onInit()
          Callback method for initialization.
 void setApplySequence(boolean applySequence)
          Specify whether to apply the sequence number and size headers to the messages prior to invoking the subscribed handlers.
 void setErrorHandler(ErrorHandler errorHandler)
          Provide an ErrorHandler strategy for handling Exceptions that occur downstream from this channel.
 void setIgnoreFailures(boolean ignoreFailures)
          Specify whether failures for one or more of the handlers should be ignored.
 
Methods inherited from class org.springframework.integration.channel.AbstractSubscribableChannel
doSend, subscribe, unsubscribe
 
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, getInterceptors, send, send, setConversionService, setDatatypes, setInterceptors, setShouldTrack
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setTaskScheduler, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.MessageChannel
send, send
 
Methods inherited from interface org.springframework.integration.context.NamedComponent
getComponentName
 

Constructor Detail

PublishSubscribeChannel

public PublishSubscribeChannel(java.util.concurrent.Executor executor)
Create a PublishSubscribeChannel that will use an Executor to invoke the handlers. If this is null, each invocation will occur in the message sender's thread.


PublishSubscribeChannel

public PublishSubscribeChannel()
Create a PublishSubscribeChannel that will invoke the handlers in the message sender's thread.

Method Detail

getComponentType

public java.lang.String getComponentType()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this method to provide component type information.

Specified by:
getComponentType in interface NamedComponent
Overrides:
getComponentType in class AbstractMessageChannel

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Provide an ErrorHandler strategy for handling Exceptions that occur downstream from this channel. This will only be applied if an Executor has been configured to dispatch the Messages for this channel. Otherwise, Exceptions will be thrown directly within the sending Thread. If no ErrorHandler is provided, and this channel does delegate its dispatching to an Executor, the default strategy is a MessagePublishingErrorHandler that sends error messages to the failed request Message's error channel header if available or to the default 'errorChannel' otherwise.

See Also:
PublishSubscribeChannel(Executor)

setIgnoreFailures

public void setIgnoreFailures(boolean ignoreFailures)
Specify whether failures for one or more of the handlers should be ignored. By default this is false meaning that an Exception will be thrown whenever a handler fails. To override this and suppress Exceptions, set the value to true.


setApplySequence

public void setApplySequence(boolean applySequence)
Specify whether to apply the sequence number and size headers to the messages prior to invoking the subscribed handlers. By default, this value is false meaning that sequence headers will not be applied. If planning to use an Aggregator downstream with the default correlation and completion strategies, you should set this flag to true.


onInit

public final void onInit()
Callback method for initialization.

Overrides:
onInit in class IntegrationObjectSupport

getDispatcher

protected BroadcastingDispatcher getDispatcher()
Specified by:
getDispatcher in class AbstractSubscribableChannel