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

Type Parameters:
Msg - type of message to send
All Superinterfaces:
org.jflux.api.core.Listener<Msg>, org.jflux.api.core.Notifier<Msg>
All Known Implementing Classes:
DefaultMessageSender

public interface MessageSender<Msg>
extends org.jflux.api.core.Listener<Msg>, org.jflux.api.core.Notifier<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 addListener(org.jflux.api.core.Listener<Msg> listener)
          Adds a Listener to be notified when a Message has been sent.
 void notifyListeners(Msg message)
          Sends the given Message.
 void removeListener(org.jflux.api.core.Listener<Msg> listener)
          Removes a Listener from being notified.
 void start()
          Initializes and connects the MessageSender, making it ready to send Messages.
 void stop()
          Stops the MessageSender, making it unable to send Messages.
 
Methods inherited from interface org.jflux.api.core.Listener
handleEvent
 

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.


notifyListeners

void notifyListeners(Msg message)
Sends the given Message.

Specified by:
notifyListeners in interface org.jflux.api.core.Notifier<Msg>
Parameters:
message - the Message to send

addListener

void addListener(org.jflux.api.core.Listener<Msg> listener)
Adds a Listener to be notified when a Message has been sent.

Specified by:
addListener in interface org.jflux.api.core.Notifier<Msg>
Parameters:
listener - the Listener to be notified

removeListener

void removeListener(org.jflux.api.core.Listener<Msg> listener)
Removes a Listener from being notified.

Specified by:
removeListener in interface org.jflux.api.core.Notifier<Msg>
Parameters:
listener - the Listener to remove


Copyright © 2011-2013. All Rights Reserved.