com.edustructures.sifworks
Interface MessagingListener

All Known Subinterfaces:
SIFMessagingListener

public interface MessagingListener

The base interface for all listener interfaces related to the exchange of messages over the underlying messaging infrastructure. For example, SIFMessagingListener extends this interface for the Schools Interoperability Framework.


Field Summary
static byte RX_DISCARD
          onMessageReceived return value indicating the message should be discarded
static byte RX_PROCESS
          onMessageReceived return value indicating the message should be processed
static byte RX_REPARSE
          onMessageReceived return value indicating the message should be reparsed and processed
 
Method Summary
 void onMessageProcessed(byte messageType, MessageInfo info)
          Called when a message has been received by the framework and successfully dispatched to the ADK's message handlers.
 byte onMessageReceived(byte messageType, java.lang.StringBuffer message)
          Called when a message has been received by the framework, before it is dispatched to the ADK's message handlers.
 void onMessageSent(byte messageType, MessageInfo info, java.lang.Object receipt)
          Called when a message has been sent by the framework.
 boolean onSendingMessage(byte messageType, MessageInfo info, java.lang.StringBuffer message)
          Called when a message is about to be sent by the framework.
 

Field Detail

RX_PROCESS

static final byte RX_PROCESS
onMessageReceived return value indicating the message should be processed

See Also:
Constant Field Values

RX_DISCARD

static final byte RX_DISCARD
onMessageReceived return value indicating the message should be discarded

See Also:
Constant Field Values

RX_REPARSE

static final byte RX_REPARSE
onMessageReceived return value indicating the message should be reparsed and processed

See Also:
Constant Field Values
Method Detail

onMessageReceived

byte onMessageReceived(byte messageType,
                       java.lang.StringBuffer message)
                       throws ADKException
Called when a message has been received by the framework, before it is dispatched to the ADK's message handlers.

An agent can implement this method to count the number of messages received, to signal the user interface or other interested parties that a message has arrived, to examine or change the raw content of incoming messages before they're dispatched to the framework, or to prevent the framework from dispatching messages to message handlers. When filtering messages, return true to allow the framework to process this message, false to silently discard the message, or throw an ADKException to return an error to the server.

Parameters:
messageType - A message type constant (e.g. SIFMessagingListener.SIF_EVENT)
message - A StringBuffer containing the message to be sent. The contents of the buffer may be modified by this method.
Returns:
One of the following codes: RX_PROCESS to allow the framework to process this message; RX_DISCARD to silently discard the message; or RX_REPARSE if this method has changed the content of the message parameter StringBuffer.
Throws:
ADKException - may be thrown by this method to return an error acknowledgement to the server

onMessageProcessed

void onMessageProcessed(byte messageType,
                        MessageInfo info)
                        throws ADKException
Called when a message has been received by the framework and successfully dispatched to the ADK's message handlers. If a message is received but not processed by a message handler -- either because of an error or because there is no Publisher, Subscriber, or QueryResults message handler to handle it -- this method is never called.

Parameters:
messageType - A message type constant (e.g. SIFMessagingListener.SIF_EVENT)
info - The MessageInfo instance associated with the message
Throws:
ADKException - may be thrown by this method to return an error acknowledgement to the server
ADKException - An ADKException may be thrown by this method to return an error acknowledgement to the server

onSendingMessage

boolean onSendingMessage(byte messageType,
                         MessageInfo info,
                         java.lang.StringBuffer message)
Called when a message is about to be sent by the framework.

An agent can implement this method to filter outbound messages in order to change the message content or prevent the framework from sending a message to the server. When filtering messages, return true to allow the framework to send this message or false to silently discard the message.

Parameters:
messageType - A message type constant (e.g. SIFMessagingListener.SIF_EVENT)
info - The MessageInfo instance associated with the message
message - A StringBuffer containing the message to be sent. The contents of the buffer may be modified by this method.

onMessageSent

void onMessageSent(byte messageType,
                   MessageInfo info,
                   java.lang.Object receipt)
Called when a message has been sent by the framework.

An agent can implement this method to count the number of messages sent or to signal the user interface or other interested parties that a message has been sent.

Parameters:
messageType - A message type constant defined by a subclass of this interface
info - The MessageInfo instance associated with the message
receipt - The acknowledgement or receipt returned by the server


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.