public abstract class AbstractMessage
extends java.lang.Object
implements java.io.Externalizable
AbstractMessage
- abstract base class for all messages.
Note:
Messages have two customizable sections; headers and body.
The headers property provides access to specialized meta information
for a specific message instance. The headers property is an associative array
with the specific header name as the key.
The body of a message contains the instance specific data that needs to be delivered
and processed by the remote destination.
The body is an object and is the payload for a message.
Modifier and Type | Field and Description |
---|---|
java.lang.Object |
body
The body of a message contains the specific data that needs to be delivered
to the remote destination.
|
java.lang.Object |
clientId
The clientId indicates which MessageAgent sent the message.
|
java.lang.String |
destination
The message destination.
|
static java.lang.String |
DESTINATION_CLIENT_ID_HEADER
DESTINATION_CLIENT_ID_HEADER - "DSDstClientId" :
messages pushed from the server may arrive in a batch, with messages
in the batch potentially targeted to different Consumer instances. |
static java.lang.String |
ENDPOINT_HEADER
ENDPOINT_HEADER - "DSEndpoint" :
messages are tagged with the endpoint id for the Channel they are sent over. |
static java.lang.String |
FLEX_CLIENT_ID_HEADER
FLEX_CLIENT_ID_HEADER - "DSId" :
this header is used to transport the global FlexClient Id value in outbound messages
once it has been assigned by the server. |
java.util.Map<java.lang.String,java.lang.Object> |
headers
The headers of a message are an associative array where the key is
the header name and the value is the header value.
|
java.lang.String |
messageId
The unique id for the message.
|
static java.lang.String |
PRIORITY_HEADER
PRIORITY_HEADER - "DSPriority" :
messages sent by a MessageAgent can have a priority header with a 0-9 numerical value
(0 being lowest) and the server can choose to use this numerical value to prioritize messages to clients. |
static java.lang.String |
REMOTE_CREDENTIALS_CHARSET_HEADER
REMOTE_CREDENTIALS_CHARSET_HEADER - "DSRemoteCredentialsCharset" :
messages that need to set remote credentials for a destination may also need to report
the character-set encoding that was used to create the credentials String using this header. |
static java.lang.String |
REMOTE_CREDENTIALS_HEADER
REMOTE_CREDENTIALS_HEADER - "DSRemoteCredentials" :
messages that need to set remote credentials for a destination carry
the Base64 encoded credentials in this header. |
static java.lang.String |
REQUEST_TIMEOUT_HEADER
REQUEST_TIMEOUT_HEADER - "DSRequestTimeout" :
messages sent with a defined request timeout use this header. |
static java.lang.String |
STATUS_CODE_HEADER
STATUS_CODE_HEADER - ""DSStatusCode" :
a status code can provide context about the nature of a response message. |
long |
timestamp
Provides access to the time stamp for the message.
|
long |
timeToLive
The time to live value of a message indicates how long the message
should be considered valid and deliverable.
|
Constructor and Description |
---|
AbstractMessage()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
createUUID()
Creates random UUID.
|
void |
readExternal(java.io.ObjectInput in) |
protected short[] |
readFlags(java.io.ObjectInput in)
Reads flags.
|
void |
writeExternal(java.io.ObjectOutput out) |
public static final java.lang.String DESTINATION_CLIENT_ID_HEADER
DESTINATION_CLIENT_ID_HEADER
- "DSDstClientId" :
messages pushed from the server may arrive in a batch, with messages
in the batch potentially targeted to different Consumer instances.public static final java.lang.String ENDPOINT_HEADER
ENDPOINT_HEADER
- "DSEndpoint" :
messages are tagged with the endpoint id for the Channel they are sent over.public static final java.lang.String FLEX_CLIENT_ID_HEADER
FLEX_CLIENT_ID_HEADER
- "DSId" :
this header is used to transport the global FlexClient Id value in outbound messages
once it has been assigned by the server.public static final java.lang.String PRIORITY_HEADER
PRIORITY_HEADER
- "DSPriority" :
messages sent by a MessageAgent can have a priority header with a 0-9 numerical value
(0 being lowest) and the server can choose to use this numerical value to prioritize messages to clients.public static final java.lang.String REMOTE_CREDENTIALS_CHARSET_HEADER
REMOTE_CREDENTIALS_CHARSET_HEADER
- "DSRemoteCredentialsCharset" :
messages that need to set remote credentials for a destination may also need to report
the character-set encoding that was used to create the credentials String using this header.public static final java.lang.String REMOTE_CREDENTIALS_HEADER
REMOTE_CREDENTIALS_HEADER
- "DSRemoteCredentials" :
messages that need to set remote credentials for a destination carry
the Base64 encoded credentials in this header.public static final java.lang.String REQUEST_TIMEOUT_HEADER
REQUEST_TIMEOUT_HEADER
- "DSRequestTimeout" :
messages sent with a defined request timeout use this header.public static final java.lang.String STATUS_CODE_HEADER
STATUS_CODE_HEADER
- ""DSStatusCode" :
a status code can provide context about the nature of a response message.public java.lang.Object body
public java.lang.Object clientId
public java.lang.String destination
public java.util.Map<java.lang.String,java.lang.Object> headers
public java.lang.String messageId
public long timestamp
public long timeToLive
public static java.lang.String createUUID()
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
protected short[] readFlags(java.io.ObjectInput in) throws java.io.IOException
in
- java.io.IOException
- if an I/O exception occurred