net.metanotion.util.observers
Interface MessageBusManager<M extends Message>

All Known Implementing Classes:
ConcurrentMessageBusManager

public interface MessageBusManager<M extends Message>

This interface represents a common way to bulk send messages to any registered observers.


Method Summary
 boolean add(Observer observer, java.lang.Object channel)
          Register an Observer as a listener.
 void closeChannel(java.lang.Object channel)
          Close a channel created by openChannel.
 void openChannel(java.lang.Object channel)
          Create a channel to send messages on.
 boolean remove(Observer observer, java.lang.Object channel)
          Remove an Observer as a listener.
 boolean send(M message, java.lang.Object channel)
          Broadcast a message to all registered observers.
 

Method Detail

openChannel

void openChannel(java.lang.Object channel)
Create a channel to send messages on.

Parameters:
channel - Object which identifies the channel others will use to send messages on.

closeChannel

void closeChannel(java.lang.Object channel)
Close a channel created by openChannel. This also will remove all observers listening on that channel.

Parameters:
channel - Object which identifies the channel others will use to send messages on.

add

boolean add(Observer observer,
            java.lang.Object channel)
Register an Observer as a listener.

Parameters:
observer - Observer to start receiving messages.
channel - The channel the observer is listening on.
Returns:
True if the observer was successfully registered, false otherwise.

remove

boolean remove(Observer observer,
               java.lang.Object channel)
Remove an Observer as a listener.

Parameters:
observer - Observer to remove
channel - The channel the observer is listening on.
Returns:
True if the observer was successfully removed, false otherwise.

send

boolean send(M message,
             java.lang.Object channel)
Broadcast a message to all registered observers.

Parameters:
message - Message to send to observers.
channel - Channel to send the message on.
Returns:
True if the message was queued, false otherwise