org.robokind.api.messaging
Interface MessageAsyncReceiver<Msg,Rec,L extends Listener<Msg>>

Type Parameters:
Msg - type of Message received
Rec - type of Record received
L - type of Listener notified of new Messages
All Known Implementing Classes:
DefaultMessageAsyncReceiver

public interface MessageAsyncReceiver<Msg,Rec,L extends Listener<Msg>>

High-Level Message Receiver. Contains a RecordAsyncReceiver for receiving Records. Contains an Adapter for converting Records back to Messages. Notifies Listeners of Messages Received.

Author:
Matthew Stevenson

Method Summary
 void addMessageListener(L listener)
          Adds a Listener to be notified when a Message has been received.
 void pause()
          Pauses a MessageAsyncReceiver.
 void removeMessageListener(L listener)
          Removes a Listener from being notified.
 void resume()
          Resumes a paused MessageAsyncReceiver.
 void setAdapter(Adapter<Rec,Msg> adapter)
          Sets the Adapter used to convert Records to Messages.
 void setRecordReceiver(RecordAsyncReceiver<Rec> service)
          Sets the RecordAsyncReceiver used to receive Records.
 void start()
          Initializes and connects the MessageAsyncReceiver, and begins receiving Messages.
 void stop()
          Stops the MessageAsyncReceiver, making it unable to receive Messages.
 

Method Detail

setRecordReceiver

void setRecordReceiver(RecordAsyncReceiver<Rec> service)
Sets the RecordAsyncReceiver used to receive Records.

Parameters:
service - theRecordReceiver to set

setAdapter

void setAdapter(Adapter<Rec,Msg> adapter)
Sets the Adapter used to convert Records to Messages.

Parameters:
adapter - the Adapter to set

start

void start()
           throws Exception
Initializes and connects the MessageAsyncReceiver, and begins receiving Messages.

Throws:
Exception - if there is an error starting

pause

void pause()
Pauses a MessageAsyncReceiver.


resume

void resume()
Resumes a paused MessageAsyncReceiver.


stop

void stop()
Stops the MessageAsyncReceiver, making it unable to receive Messages.


addMessageListener

void addMessageListener(L listener)
Adds a Listener to be notified when a Message has been received.

Parameters:
listener - the Listener to be notified

removeMessageListener

void removeMessageListener(L listener)
Removes a Listener from being notified.

Parameters:
listener - the Listener to remove


Copyright © 2011-2012. All Rights Reserved.