|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.protocol.DataObject
com.genesyslab.platform.commons.protocol.Message
public abstract class Message
This abstract class provides the interface used for all Event
classes. When events are received from a server, your application will use
this interface to process them.
interactionServerProtocol.send(requestAgentLogin);
Message response = interactionServerProtocol.receive();
send()
and receive()
methods into a single method call by using the request()
method, like this:
Message response =
interactionServerProtocol.request(requestAgentLogin);
Message unsolicitedEvent = interactionServerProtocol.receive();
Message
. This is the interface implemented by all
events in the Platform SDK. Some requests will be answered by an event that is
specific to the request, while others will receive a more generic response of
EventAck
, which simply acknowledges that your request was
successful. If a request fails, the server will send an EventError
.
RequestAgentLogin
, for example, will receive an
EventAck
, while an unsuccessful one will receive an
EventError
. You can use a switch statement to test which response
you received, as outlined here:
switch(response.messageId())
{
case EventAck.ID:
// The request succeeded, carry out appropriate processing...
case EventError.ID:
// The request failed, carry out appropriate processing...
...
}
Constructor Summary | |
---|---|
protected |
Message(int id,
java.lang.String name,
ProtocolDescription description)
|
Method Summary | |
---|---|
Message |
cloneMessage()
|
abstract Endpoint |
getEndpoint()
Indicates server URI from which current message has been received. |
abstract java.lang.Object |
getMessageAttribute(java.lang.String index)
Returns message attribute as object by specified index. |
ProtocolDescription |
getProtocolDescription()
|
abstract int |
getProtocolId()
Returns hash code of protocol object which handled the message. |
int |
messageId()
Returns message id. |
java.lang.String |
messageName()
Returns message name. |
protected void |
setProtocolDescription(ProtocolDescription description)
|
Methods inherited from class com.genesyslab.platform.commons.protocol.DataObject |
---|
equals, hashCode, toString, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Message(int id, java.lang.String name, ProtocolDescription description)
Method Detail |
---|
public int messageId()
public java.lang.String messageName()
public abstract java.lang.Object getMessageAttribute(java.lang.String index)
index
- index of attribute
public abstract int getProtocolId()
public ProtocolDescription getProtocolDescription()
getProtocolDescription
in interface ProtocolDescriptionSupport
protected void setProtocolDescription(ProtocolDescription description)
public abstract Endpoint getEndpoint()
public Message cloneMessage()
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |