Message Wrapper

    MessageWrapperClass.png

     

     

    required MessageType   _messageType     = 1;
    optional uint64        _sourceID        = 2;  //No need to specify when sending.
    optional uint64        _destinationID   = 3;  
    optional MessageFormat _messageFormat   = 4;  //Payload Datatype or reply type.
    optional bytes         _payload         = 5;  //Payload data.
    optional uint32        _receiptIndex    = 6;  //Messages with this will expect an instant acknowledgement from the detination.
    optional uint32        _streamIndex     = 7;  //Used for identifying a sequence of packets (typically a binary stream).
    optional uint32        _minutesToLive   = 8;  //How long the network will keep the message for delievry.
    optional uint32        _rpcCallback     = 9;  //unique reference for a remote procedure call.

     

     

    _messageType (required)

    The message type, specifies what a message is for, and coupled with _messageFormat (see below) defines how the message should be processed.  Unlike _messageFormat, there is no default, so a messageType must be set.  In it's simplest form only a message type is sent, and the receiving client knows what to do with it.  Typically a payload will be attached. Where a Protocol Buffer message has been serialized into the _payload, the _messageType is necessary to instruct the deserializer what class to work with.

    _sourceID

    Do not set this when sending.  On receiving, this will be set with the senders ID (zero if originated from the server)

    _destinationID

    Set to the client TurboID your sending a message to (unless it's a message for the server)

    _messageFormat
    enum MessageFormat
    {
        ProtoMessage        = 0;  //Payload contains a protoMessage [DEFAULT]
        ByteStream          = 1;  //Payload contains binary
        TextUTF8            = 2;  //Payload contains text in UTF-8 format
        ProtoMessageZlib    = 3;  //Payload contains a protoMessage compressed with ZLib
        ReturnReceipt       = 5;  //Reply to an _receiptIndex by the recipient.  Payload is normally empty.  This is just conformation of delivery.
        NoDestination       = 8;  //Reply - Destination ID not recognised.
        UnsupportedMessage  = 9;  //Reply - message type not implemented by the destination (it's up to the client to return this)
        RPCProcessSuccess   =10;  //RPC callback, to say the process has successfully been processed.  Payload may contain UTF-8 text message
        RPCProcessFail      =11;  //RPC callback, to say the process has failed.  Payload may contain UTF-8 text message
    }

     Notes:

    _messageFormat = ProtoMessage (DEFAULT)

    The _payload field (if set) is a serialized Protocol Buffer message class.  The _messageType must reflect the message class used for deserialization.

    The DLL provides extensions as a helper.

    _messageFormat = ByteStream

    reserved

    _messageFormat =TextUTF8

    Text stored as UTF8 bytes.  Encoder.UTF8.GetString(wrap._payload)

    _messageFormat = ProtoMessageZLib

    Used interanally for compression.

    _messageFormat = ReturnReceipt

    An automated message returned from a client, having received a message with a Return Receipt.  The _receiptIndex field will have the same number as that was sent.  This is useful for knowing if a message has be delivered.  See here for more details.

    _payload

    An optional  Byte[]  payload.  See _messageFormat.

    _receiptIndex

    Any message you send, with a receiptIndex > 0 will request that a receiving client returns a Message Receipt back.

    _streamIndex

    reserved

    _minutesToLive

    How long to buffer the message to the receiving client, after which drop it.  See Store & Forward

    _rpcCallback

    Some messages allow callbacks.  This does not apply to breakdown recovery jobs at this time.