MigratoryDataMessage

Represent a message.

Public Functions

Name
MigratoryDataMessage(String subject, String content, QoS qos, boolean retained)
Create a MigratoryDataMessage object.
String getSubject()
Get the subject of the message.
String getContent()
Get the content of the message.
QoS getQos()
Get the QoS level of the message.
boolean isRetained()
Indicate whether or not the message should be/was retained by the server.
void setCompressed(boolean compressed)
Set whether to compress the content of the message or not.
boolean isCompressed()
Indicate whether or not the message should be/was compressed.

Public Functions Documentation

function MigratoryDataMessage

MigratoryDataMessage(
    String subject,
    String content,
    QoS qos,
    boolean retained
)

Create a MigratoryDataMessage object.

Parameters:

  • subject The subject of the message
  • content The content of the message
  • qos the QoS level of the message; the default is [QoS.GUARANTEED](/docs/client-api/php/classes/interfaceqos/#variable-guaranteed) (OPTIONAL)
  • retained indicate whether or not the message should be/was retained by the server; the default is true (OPTIONAL)

Exceptions:

function getSubject

String getSubject()

Get the subject of the message.

Return: A string representing the subject of the message

function getContent

String getContent()

Get the content of the message.

Return: A string representing the content of the message

function getQos

QoS getQos()

Get the QoS level of the message.

Return: the QoS level of the message

function isRetained

inline boolean 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 setCompressed

void setCompressed(
    boolean 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

boolean 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.