![]() |
Diffusion .NET Classic API - Core and Common
5.9.4
|
This is the base class for all messages. All messages have the same basic format, that being: More...
Public Member Functions | |
abstract int | GetMessageLength () |
Returns the total message length including header. Note that for an encoded data message this will return the encoded message length. More... | |
abstract ByteBuffer | GetBufferForWriting (ConnectionCapabilities capabilities) |
Returns the message in buffer format for writing. If the message is encoded or needs encoding then this will return the encoded version. However, if the supplied capabilities indicate that the caller can not handled the encoded version then the unencoded version would be returned. More... | |
override bool | IsTopicMessage () |
override List< string > | GetHeaders () |
Get the headers of this message. More... | |
override string | GetHeader (int index) |
Returns a header value. More... | |
override void | SetHeaders (params string[] headers) |
Sets headers. One or more separate headers may be set as required. Headers may be set once and only once after constructing a message and before any data is added to the message. More... | |
override void | SetHeaders (List< string > headers) |
Set the headers of this message. More... | |
override int | CompareTo (IMessage message) |
Compares the current object with another object of the same type. More... | |
override int | CompareTo (IMessage message, MessageComparator comparator) |
Compares this message to another message using a specified comparator. More... | |
override bool | Equals (object obj) |
override int | GetHashCode () |
virtual bool | IsDataMessage () |
virtual bool | IsControlMessage () |
virtual void | AddFixedHeader (string header) |
Can be used by subclasses to add an optional fixed header after creation. More... | |
void | Write (ByteBuffer buffer, ConnectionCapabilities capabilities) |
Write the message to a byte buffer. More... | |
void | Write (SslStream stream) |
Writes the message to a secure stream. More... | |
void | Write (ClientSocket socket) |
Write the message to a socket channel. More... | |
void | Write (SslStream stream, ConnectionCapabilities capabilities, bool async) |
Write the message to a secure stream. More... | |
void | Write (ClientSocket socket, ConnectionCapabilities capabilities) |
Write the message to a socket channel. More... | |
Protected Member Functions | |
MessageImpl (IExternalMessage message) | |
Constructor. More... | |
MessageImpl (byte type) | |
Constructor for new messages. More... | |
MessageImpl (byte type, ByteBuffer buffer, IMessageHeaderTransformer headerTransformer) | |
Constructor for messages created from an incoming message buffer. For message types with headers this unpacks the header values and calls down to the ApplyHeaderValues method to capture and validate the headers. Any values required must be copied from the supplied buffer which should remain untouched. Also the message length must be determined from the length in the buffer rather than the buffer limit which could be longer. More... | |
void | SetHeaderLength () |
Sets the header length according to the sum of the current headers plus delimiters plus static header length. More... | |
List< string > | GetAllHeaders () |
Gets all headers (fixed and user). More... | |
virtual int | GetNumberOfFixedHeaders () |
Returns the number of fixed headers that the message has (must have). More... | |
virtual void | ApplyFixedHeaders (List< string > headers, IMessageHeaderTransformer headerTransformer) |
This is used for messages that have headers when a message is created from an existing byte buffer. This is called during construction so that the subclasses can capture and validate the header field values. More... | |
virtual string | GetAckId () |
virtual void | SetFixedHeaders (params string[] headers) |
Sets fixed headers. This must be called during message construction. More... | |
Static Protected Member Functions | |
static void | CheckHeaders (int length, params string[] headers) |
Utility method to check that the correct number of headers have been supplied. More... | |
Protected Attributes | |
List< string > | theUserHeaders |
User headers. More... | |
Properties | |
int | HeaderLength [get, set] |
Returns the length of the header. More... | |
bool | SetMessageLengthOnWrite [get, set] |
Determines whether we set the message length explicitly prior to writing. More... | |
virtual byte | MessageType [get, set] |
Get/set the type of this message. More... | |
bool | HasHeaders [get] |
Does this message have headers? More... | |
byte | Priority [get, set] |
Get/set the priority of this message. More... | |
bool | IsExpedited [get, set] |
Get/set whether this message should be expedited. More... | |
List< string > | FixedHeaders [get] |
Returns the collection of fixed headers. More... | |
string | AckId [get, set] |
Get/set the acknowledgement id. More... | |
int | DataPosition [get, set] |
Get/set the data position. Only useful when initialising from buffer. More... | |
override long | Timestamp [get, set] |
Get/set the timestamp of this message. More... | |
override bool | IsLocked [get, set] |
Get/set whether this message is locked. More... | |
bool | HasUserHeaders [get] |
Returns whether this message has user headers. More... | |
Additional Inherited Members |
This is the base class for all messages. All messages have the same basic format, that being:
LLLLTEheaderRbody
where:
LLLL is the total message length as a 32 bit signed twos complement integer giving a maximum message size of 2,147,483,647.
T is the message type (byte).
E is the message byte encoding indicating the byte encoding of the body of the message. This will be zero for message types that have no body.
headerR is the header which may be one or more field values separated by field delimiters and terminated by a record delimiter (R). Headers are optional so some message types may not have a header.
body is the message body. Some message types (control messages) have no body.
Some message types have neither a body or a header.
|
protected |
Constructor.
message |
|
protected |
Constructor for new messages.
type |
|
protected |
Constructor for messages created from an incoming message buffer. For message types with headers this unpacks the header values and calls down to the ApplyHeaderValues method to capture and validate the headers. Any values required must be copied from the supplied buffer which should remain untouched. Also the message length must be determined from the length in the buffer rather than the buffer limit which could be longer.
type | |
buffer | |
headerTransformer |
|
virtual |
Can be used by subclasses to add an optional fixed header after creation.
header |
Reimplemented in PushTechnology.DiffusionCore.Messaging.DataMessageImpl.
|
protectedvirtual |
This is used for messages that have headers when a message is created from an existing byte buffer. This is called during construction so that the subclasses can capture and validate the header field values.
headers | Headers as read from input message. |
headerTransformer | An optional header transformer object to be used as the subclass wishes. |
Reimplemented in PushTechnology.DiffusionCore.Messaging.Topic.TopicMessageImpl, PushTechnology.DiffusionCore.Messaging.CommandLoadMessage, PushTechnology.DiffusionCore.Messaging.Topic.TopicLoadMessage, PushTechnology.DiffusionCore.Messaging.CommandNotificationMessage, PushTechnology.DiffusionCore.Messaging.TopicLoadMessageAck, PushTechnology.DiffusionCore.Messaging.DeltaMessageAck, and PushTechnology.DiffusionCore.Messaging.CommandMessage.
|
staticprotected |
Utility method to check that the correct number of headers have been supplied.
length | |
headers |
|
virtual |
Compares the current object with another object of the same type.
message | An object to compare with this object. |
Implements PushTechnology.DiffusionCore.Messaging.MessageBase.
Reimplemented in PushTechnology.DiffusionCore.Messaging.Topic.TopicMessageImpl.
|
virtual |
Compares this message to another message using a specified comparator.
message | |
comparator |
summary>
Determines whether the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" />. /summary> returns> true if the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" />; otherwise, false. /returns> <param name="obj"> The <see cref="T:System.Object" /> to compare with the current <see cref="T:System.Object" />. </param> <exception cref="T:System.NullReferenceException"> The <paramref name="obj" /> parameter is null. </exception><filterpriority>2</filterpriority>
Implements PushTechnology.DiffusionCore.Messaging.MessageBase.
|
protectedvirtual |
Reimplemented in PushTechnology.DiffusionCore.Messaging.Topic.TopicMessageImpl.
|
protected |
Gets all headers (fixed and user).
|
pure virtual |
Returns the message in buffer format for writing. If the message is encoded or needs encoding then this will return the encoded version. However, if the supplied capabilities indicate that the caller can not handled the encoded version then the unencoded version would be returned.
capabilities | capabilities or null indicating ALL capabilities. |
Implemented in PushTechnology.DiffusionCore.Messaging.DataMessageImpl.
override int PushTechnology.DiffusionCore.Messaging.MessageImpl.GetHashCode | ( | ) |
|
virtual |
Returns a header value.
index | The header index (first header has index 0) |
Implements PushTechnology.DiffusionCore.Messaging.MessageBase.
|
virtual |
Get the headers of this message.
Implements PushTechnology.DiffusionCore.Messaging.MessageBase.
|
pure virtual |
Returns the total message length including header. Note that for an encoded data message this will return the encoded message length.
Implemented in PushTechnology.DiffusionCore.Messaging.DataMessageImpl.
|
protectedvirtual |
Returns the number of fixed headers that the message has (must have).
Reimplemented in PushTechnology.DiffusionCore.Messaging.Topic.TopicMessageImpl, PushTechnology.DiffusionCore.Messaging.CommandLoadMessage, PushTechnology.DiffusionCore.Messaging.CommandNotificationMessage, PushTechnology.DiffusionCore.Messaging.TopicLoadMessageAck, PushTechnology.DiffusionCore.Messaging.DeltaMessageAck, and PushTechnology.DiffusionCore.Messaging.CommandMessage.
|
virtual |
Reimplemented in PushTechnology.DiffusionCore.Messaging.Topic.TopicLoadMessage.
|
virtual |
Reimplemented in PushTechnology.DiffusionCore.Messaging.DataMessageImpl.
|
virtual |
Implements PushTechnology.DiffusionCore.Messaging.MessageBase.
Reimplemented in PushTechnology.DiffusionCore.Messaging.Topic.TopicMessageImpl.
|
protectedvirtual |
Sets fixed headers. This must be called during message construction.
headers |
Reimplemented in PushTechnology.DiffusionCore.Messaging.DataMessageImpl, and PushTechnology.DiffusionCore.Messaging.Topic.TopicLoadMessage.
|
protected |
Sets the header length according to the sum of the current headers plus delimiters plus static header length.
|
virtual |
Sets headers. One or more separate headers may be set as required. Headers may be set once and only once after constructing a message and before any data is added to the message.
headers |
Implements PushTechnology.DiffusionCore.Messaging.MessageBase.
|
virtual |
Set the headers of this message.
headers |
Implements PushTechnology.DiffusionCore.Messaging.MessageBase.
void PushTechnology.DiffusionCore.Messaging.MessageImpl.Write | ( | ByteBuffer | buffer, |
ConnectionCapabilities | capabilities | ||
) |
Write the message to a byte buffer.
buffer | |
capabilities | The connection capabilities which will determine whether the message written should be encoded or decoded. Null would indicates all possible capabilities. |
void PushTechnology.DiffusionCore.Messaging.MessageImpl.Write | ( | SslStream | stream | ) |
Writes the message to a secure stream.
stream |
void PushTechnology.DiffusionCore.Messaging.MessageImpl.Write | ( | ClientSocket | socket | ) |
Write the message to a socket channel.
socket |
void PushTechnology.DiffusionCore.Messaging.MessageImpl.Write | ( | SslStream | stream, |
ConnectionCapabilities | capabilities, | ||
bool | async | ||
) |
Write the message to a secure stream.
stream | |
capabilities | |
async |
void PushTechnology.DiffusionCore.Messaging.MessageImpl.Write | ( | ClientSocket | socket, |
ConnectionCapabilities | capabilities | ||
) |
Write the message to a socket channel.
socket | |
capabilities | The connection capabilities which will determine whether the message written should be encoded or decoded. |
|
protected |
User headers.
|
getset |
Get/set the acknowledgement id.
|
getset |
Get/set the data position. Only useful when initialising from buffer.
|
get |
Returns the collection of fixed headers.
|
get |
Does this message have headers?
|
get |
Returns whether this message has user headers.
|
getset |
Returns the length of the header.
|
getset |
Get/set whether this message should be expedited.
|
getset |
Get/set whether this message is locked.
|
getset |
Get/set the type of this message.
|
getset |
Get/set the priority of this message.
|
getset |
Determines whether we set the message length explicitly prior to writing.
|
getset |
Get/set the timestamp of this message.