org.robokind.api.messaging
Interface MessageSender<Msg>

Type Parameters:
Msg - type of message to send
All Known Implementing Classes:
DefaultMessageSender

public interface MessageSender<Msg>

High-level message sender for sending API objects. A typical MessageSender will serialize the Message to a Record and send it using a low-level RecordSender. Notifies Listeners of Messages sent.

Author:
Matthew Stevenson

Method Summary
 void addMessageListener(Listener<Msg> listener)
          Adds a Listener to be notified when a Message has been sent.
 void removeMessageListener(Listener<Msg> listener)
          Removes a Listener from being notified.
 void sendMessage(Msg message)
          Sends the given Message.
 void start()
          Initializes and connects the MessageSender, making it ready to send Messages.
 void stop()
          Stops the MessageSender, making it unable to send Messages.
 

Method Detail

start

void start()
           throws Exception
Initializes and connects the MessageSender, making it ready to send Messages.

Throws:
Exception - if there is an error starting

stop

void stop()
Stops the MessageSender, making it unable to send Messages.


sendMessage

void sendMessage(Msg message)
Sends the given Message.

Parameters:
message - the Message to send

addMessageListener

void addMessageListener(Listener<Msg> listener)
Adds a Listener to be notified when a Message has been sent.

Parameters:
listener - the Listener to be notified

removeMessageListener

void removeMessageListener(Listener<Msg> listener)
Removes a Listener from being notified.

Parameters:
listener - the Listener to remove


Copyright © 2011-2012. All Rights Reserved.