org.springframework.integration.dispatcher
Class PublishSubscribeChannel

java.lang.Object
  extended by org.springframework.integration.channel.AbstractMessageChannel
      extended by org.springframework.integration.dispatcher.PublishSubscribeChannel
All Implemented Interfaces:
org.springframework.beans.factory.BeanNameAware, MessageChannel, BlockingSource, BlockingTarget, MessageSource, MessageTarget, Subscribable

public class PublishSubscribeChannel
extends AbstractMessageChannel
implements Subscribable

Author:
Mark Fisher

Field Summary
private  BroadcastingDispatcher dispatcher
           
 
Constructor Summary
PublishSubscribeChannel()
           
PublishSubscribeChannel(org.springframework.core.task.TaskExecutor taskExecutor)
          Create a PublishSubscribeChannel that will use a TaskExecutor to publish its Messages.
 
Method Summary
 java.util.List<Message<?>> clear()
          Remove all Messages from this channel.
protected  Message<?> doReceive(long timeout)
          Subclasses must implement this method.
protected  boolean doSend(Message<?> message, long timeout)
          Subclasses must implement this method.
 java.util.List<Message<?>> purge(MessageSelector selector)
          Remove any Messages that are not accepted by the provided selector.
 boolean subscribe(MessageTarget target)
          Register a MessageTarget as a subscriber to this source.
 boolean unsubscribe(MessageTarget target)
          Remove a MessageTarget from the subscribers of this source.
 
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, getName, receive, receive, send, send, setBeanName, setInterceptors, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dispatcher

private final BroadcastingDispatcher dispatcher
Constructor Detail

PublishSubscribeChannel

public PublishSubscribeChannel()

PublishSubscribeChannel

public PublishSubscribeChannel(org.springframework.core.task.TaskExecutor taskExecutor)
Create a PublishSubscribeChannel that will use a TaskExecutor to publish its Messages.

Method Detail

subscribe

public boolean subscribe(MessageTarget target)
Description copied from interface: Subscribable
Register a MessageTarget as a subscriber to this source.

Specified by:
subscribe in interface Subscribable

unsubscribe

public boolean unsubscribe(MessageTarget target)
Description copied from interface: Subscribable
Remove a MessageTarget from the subscribers of this source.

Specified by:
unsubscribe in interface Subscribable

doSend

protected boolean doSend(Message<?> message,
                         long timeout)
Description copied from class: AbstractMessageChannel
Subclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is at capacity (if the value is 0, it must return immediately with or without success). A negative timeout value indicates that the method should block until either the message is accepted or the blocking thread is interrupted.

Specified by:
doSend in class AbstractMessageChannel

doReceive

protected Message<?> doReceive(long timeout)
Description copied from class: AbstractMessageChannel
Subclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is empty (if the value is 0, it must return immediately with or without success). A negative timeout value indicates that the method should block until either a message is available or the blocking thread is interrupted.

Specified by:
doReceive in class AbstractMessageChannel

clear

public java.util.List<Message<?>> clear()
Description copied from interface: MessageChannel
Remove all Messages from this channel.

Specified by:
clear in interface MessageChannel

purge

public java.util.List<Message<?>> purge(MessageSelector selector)
Description copied from interface: MessageChannel
Remove any Messages that are not accepted by the provided selector.

Specified by:
purge in interface MessageChannel