org.kaariboga.io
Interface KbMessageHandler

All Known Implementing Classes:
DeliveryService, DomainServer

public interface KbMessageHandler

Every class in the Kaariboga environment, that is capable of receiving messages, should implement this interface.


Field Summary
static int AGENT_NOT_REACHABLE
          The target base is online, but the agent is not there.
static int BASE_NOT_REACHABLE
          The target base of the message can not be reached.
static int BASE_OFFLINE
          No messages can be delivered to other bases, because the base is offline.
 
Method Summary
 void handleMessage(KaaribogaMessage message)
          Called when a message for the DeliveryServiceUser has arrived.
 void messageDeliveryError(int errorCode, KaaribogaMessage message)
          Called in case a message could not be delivered.
 

Field Detail

BASE_NOT_REACHABLE

public static final int BASE_NOT_REACHABLE
The target base of the message can not be reached.

AGENT_NOT_REACHABLE

public static final int AGENT_NOT_REACHABLE
The target base is online, but the agent is not there.

BASE_OFFLINE

public static final int BASE_OFFLINE
No messages can be delivered to other bases, because the base is offline.
Method Detail

handleMessage

public void handleMessage(KaaribogaMessage message)
Called when a message for the DeliveryServiceUser has arrived.
Parameters:
message - The message, that has arrived for the user.

messageDeliveryError

public void messageDeliveryError(int errorCode,
                                 KaaribogaMessage message)
Called in case a message could not be delivered. It is not guaranteed, that this method is called in every case, for example if a DeliveryService is offline, it may decide to store incoming messages until it is online again.
Parameters:
errorCode - Delivery error code. At the moment the following codes exit: BASE_NOT_REACHABLE, AGENT_NOT_REACHABLE, BASE_OFFLINE
message - The message, that could not be delivered. Note, that this may be null if the message no longer exists on the sending host. Future versions of KaaribogaMessage may include a global unique identifier.