MqttMessage Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.provisioning.device.transport.mqtt.MqttMessage

public class MqttMessage

Constructor Summary

Constructor Description
MqttMessage(String topic)

Constructor that takes the topic of the Message

MqttMessage(String topic, byte[] payload)

Constructor that takes the topic of the Message and payload

MqttMessage(String topic, org.eclipse.paho.client.mqttv3.MqttMessage mqttMessage)

Constructor that takes the topic of the Message and a PAHO MqttMessage

Method Summary

Modifier and Type Method and Description
org.eclipse.paho.client.mqttv3.MqttMessage getMqttMessage()

Gets the PAHO MqttMessage from an existing message

byte [] getPayload()

Returns the Message Payload

MqttQos getQos()

Gets the Qos value of the Message

String getTopic()

Gets the topic of the message

int retrieveQosValue(MqttQos qos)

Converts the MqttQOS value to a integer representation

void setPayload(byte[] payload)

Sets the Message Payload

void setQos(MqttQos qos)

Sets the Qos value of the Message

void setTopic(String topic)

Sets the topic of the message

Constructor Details

MqttMessage

public MqttMessage(String topic)

Constructor that takes the topic of the Message

Parameters:

topic - The topic of the message

MqttMessage

public MqttMessage(String topic, byte[] payload)

Constructor that takes the topic of the Message and payload

Parameters:

topic - The topic of the message
payload - The payload of the message

MqttMessage

public MqttMessage(String topic, org.eclipse.paho.client.mqttv3.MqttMessage mqttMessage)

Constructor that takes the topic of the Message and a PAHO MqttMessage

Parameters:

topic - The topic of the message
mqttMessage - The mqtt message

Method Details

getMqttMessage

public org.eclipse.paho.client.mqttv3.MqttMessage getMqttMessage()

Gets the PAHO MqttMessage from an existing message

Returns:

the mqtt message

getPayload

public byte [] getPayload()

Returns the Message Payload

Returns:

the message in byte[]

getQos

public MqttQos getQos()

Gets the Qos value of the Message

Returns:

the quality of service

getTopic

public String getTopic()

Gets the topic of the message

Returns:

Topic represented as a string

retrieveQosValue

public static int retrieveQosValue(MqttQos qos)

Converts the MqttQOS value to a integer representation

Parameters:

qos - MqttQos value

Returns:

the qos value

setPayload

public void setPayload(byte[] payload)

Sets the Message Payload

Parameters:

payload - the message in byte[]

setQos

public void setQos(MqttQos qos)

Sets the Qos value of the Message

Parameters:

qos - the quality of service

setTopic

public void setTopic(String topic)

Sets the topic of the message

Parameters:

topic - The topic of the message

Applies to