MigratoryDataMessage

Represent a message.

#include <client-ios/MigratoryDataMessage.h>

Inherits from NSObject

Public Functions

Name
virtual id init:content:(NSString * subject, NSString * content)
Create a MigratoryDataMessage object.
virtual id init:content:closure:(NSString * subject, NSString * content, NSString * closure)
Create a MigratoryDataMessage object.
virtual id init:content:closure:qos:retained:(NSString * subject, NSString * content, NSString * closure, MigratoryDataQoS qos, bool retained)
Create a MigratoryDataMessage object.
virtual id init:content:closure:qos:retained:replySubject:(NSString * subject, NSString * content, NSString * closure, MigratoryDataQoS qos, bool retained, NSString * replySubject)
Create a MigratoryDataMessage object.
virtual NSString * getSubject()
Get the subject of the message.
virtual NSString * getContent()
Get the content of the message.
virtual NSString * getClosure()
Get the closure of the message.
virtual bool isRetained()
Indicate whether or not the message should be/was retained by the server.
virtual NSString * getReplySubject()
Get the subject to be used to reply to this message.
virtual MigratoryDataQoS getQos()
Get the QoS level of the message.
virtual MigratoryDataMessageType getMessageType()
Get the MessageType of the message.
virtual void setCompressed:(bool compressed)
Set whether to compress the content of the message or not.
virtual bool isCompressed()
Indicate whether or not the message should be/was compressed.

Public Functions Documentation

function init:content:

virtual id init:content:(
    NSString * subject,
    NSString * content
)

Create a MigratoryDataMessage object.

Parameters:

  • subject The subject of the message
  • content The content of the message

function init:content:closure:

virtual id init:content:closure:(
    NSString * subject,
    NSString * content,
    NSString * closure
)

Create a MigratoryDataMessage object.

Parameters:

  • subject The subject of the message
  • content The content of the message
  • closure The closure of the message (OPTIONAL)

function init:content:closure:qos:retained:

virtual id init:content:closure:qos:retained:(
    NSString * subject,
    NSString * content,
    NSString * closure,
    MigratoryDataQoS qos,
    bool retained
)

Create a MigratoryDataMessage object.

Parameters:

  • subject The subject of the message
  • content The content of the message
  • closure The closure of the message (OPTIONAL)
  • qos the QoS level of the message; the default is MigratoryDataQoS.GUARANTEED (OPTIONAL)
  • retained indicate whether or not the message should be/was retained by the server; the default is true (OPTIONAL)

function init:content:closure:qos:retained:replySubject:

virtual id init:content:closure:qos:retained:replySubject:(
    NSString * subject,
    NSString * content,
    NSString * closure,
    MigratoryDataQoS qos,
    bool retained,
    NSString * replySubject
)

Create a MigratoryDataMessage object.

Parameters:

  • subject The subject of the message
  • content The content of the message
  • closure The closure of the message (OPTIONAL)
  • qos the QoS level of the message; the default is MigratoryDataQoS.GUARANTEED (OPTIONAL)
  • retained indicate whether or not the message should be/was retained by the server; the default is true (OPTIONAL)
  • replySubject the reply subject of the message (OPTIONAL)

If a reply subject is attached to a message, the message acts as a request message. The clients which receive a request message will be able to reply by sending back one or more messages having as subject the reply subject.

Note: If the reply subject is not already subscribed, it will be subscribed by the library implicitly, and it can be reused for request/reply interactions (and even for receiving multiple replies to one request). When it is not needed anymore, it should be unsubscribed explicitly.

function getSubject

virtual NSString * getSubject()

Get the subject of the message.

Return: A string representing the subject of the message

function getContent

virtual NSString * getContent()

Get the content of the message.

Return: A string representing the content of the message

function getClosure

virtual NSString * getClosure()

Get the closure of the message.

Return: The closure data of the message

function isRetained

virtual bool isRetained()

Indicate whether or not the message should be/was retained by the server.

Return: true if the message should be, or was, retained by the server

function getReplySubject

virtual NSString * getReplySubject()

Get the subject to be used to reply to this message.

Return: The subject to be used to reply to this message.

A client which receives a message containing a reply subject should interpret the message as a request. It has the option to use the reply subject - extracted from the message with this method - to send a reply.

function getQos

virtual MigratoryDataQoS getQos()

Get the QoS level of the message.

Return: the QoS level of the message

function getMessageType

virtual MigratoryDataMessageType getMessageType()

Get the MessageType of the message.

Return: the message type of the message

function setCompressed:

virtual void setCompressed:(
    bool compressed
)

Set whether to compress the content of the message or not.

Parameters:

  • compressed if true, the content of the message will be published in ZLIB-compressed format; if false no compression format will be used; the default value is false.

Note: If compression is enabled with this method but the size of the content of the message is smaller than the size of compressed content, then the message will be sent uncompressed to save bandwidth and CPU cycles with the decompression on the receiver side.

function isCompressed

virtual bool isCompressed()

Indicate whether or not the message should be/was compressed.

Return: Return whether or not the message should be/was compressed. If the received message was compressed, the library automatically decompresses its content without any additional code.


Updated on 6 November 2020 at 13:20:01 EET