net.sf.genuine.organizer
Interface MessageListener


public interface MessageListener

Every object that would like to receive messages sent to a channel has to implement this interface and register at the channel.

If a message has been marked as being vetoable first all listeners' checkVetoableMessage methods are called. Only if no listener throws a MessageVetoException, the message bus calls receiveMessage(net.sf.genuine.organizer.Message) afterwards. That means, when checkVetoableMessage(net.sf.genuine.organizer.Message) is called, the listener must not perform any internal actions, and when receiveMessage(net.sf.genuine.organizer.Message) is called, the listener must accept the message.

Author:
Tim Wellhausen
See Also:
MessageBus, Channel, MessageVetoException

Method Summary
 void checkVetoableMessage(Message message)
          Called to let the listener check whether is would accept the given message.
 void receiveMessage(Message message)
          Callback method that is executed when a message has been sent to the listener.
 

Method Detail

checkVetoableMessage

public void checkVetoableMessage(Message message)
                          throws MessageVetoException
Called to let the listener check whether is would accept the given message. If it does not accept the message, it has to throw a MessageVetoException. If such an exception is thrown the message is not delivered to any listeners. Thus, receiveMessage is never called for that message.

Throws:
MessageVetoException

receiveMessage

public void receiveMessage(Message message)
Callback method that is executed when a message has been sent to the listener.