Package io.micronaut.mqtt.v5.bind
Class MqttV5BindingContext
java.lang.Object
io.micronaut.mqtt.v5.bind.MqttV5BindingContext
- All Implemented Interfaces:
MqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
@Internal
public final class MqttV5BindingContext
extends Object
implements MqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
A binding context for MQTT v5 messages.
- Since:
- 1.0.0
- Author:
- James Kleeh
-
Constructor Summary
ConstructorDescriptionMqttV5BindingContext
(org.eclipse.paho.mqttv5.client.MqttAsyncClient client, org.eclipse.paho.mqttv5.common.MqttMessage message) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Acknowledges a message.int
getId()
org.eclipse.paho.mqttv5.common.MqttMessage
byte[]
org.eclipse.paho.mqttv5.common.packet.MqttProperties
int
getQos()
getTopic()
boolean
void
setPayload
(byte[] payload) Sets the message payload.void
setProperties
(org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) void
setQos
(int qos) Sets the message qos.void
setRetained
(boolean retained) Sets the message to be retained.void
Sets the message topic.
-
Constructor Details
-
MqttV5BindingContext
public MqttV5BindingContext(org.eclipse.paho.mqttv5.client.MqttAsyncClient client, org.eclipse.paho.mqttv5.common.MqttMessage message) - Parameters:
client
- The clientmessage
- The message
-
-
Method Details
-
getPayload
public byte[] getPayload()- Specified by:
getPayload
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Returns:
- The message payload
-
setPayload
public void setPayload(byte[] payload) Description copied from interface:MqttBindingContext
Sets the message payload.- Specified by:
setPayload
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Parameters:
payload
- The payload
-
isRetained
public boolean isRetained()- Specified by:
isRetained
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Returns:
- True if the message is retained
-
setRetained
public void setRetained(boolean retained) Description copied from interface:MqttBindingContext
Sets the message to be retained.- Specified by:
setRetained
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Parameters:
retained
- The retained flag
-
getQos
public int getQos()- Specified by:
getQos
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Returns:
- The message QOS
-
setQos
public void setQos(int qos) Description copied from interface:MqttBindingContext
Sets the message qos. Must be 0, 1, or 2.- Specified by:
setQos
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Parameters:
qos
- The qos
-
getTopic
- Specified by:
getTopic
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Returns:
- The message topic
-
setTopic
Description copied from interface:MqttBindingContext
Sets the message topic.- Specified by:
setTopic
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Parameters:
topic
- The topic
-
getProperties
public org.eclipse.paho.mqttv5.common.packet.MqttProperties getProperties() -
setProperties
public void setProperties(org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) -
getId
public int getId()- Specified by:
getId
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Returns:
- The message ID
-
acknowlege
public void acknowlege()Description copied from interface:MqttBindingContext
Acknowledges a message.- Specified by:
acknowlege
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
-
getNativeMessage
public org.eclipse.paho.mqttv5.common.MqttMessage getNativeMessage()- Specified by:
getNativeMessage
in interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
- Returns:
- The underlying message instance
-