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
ConstructorsConstructorDescriptionMqttV5BindingContext(org.eclipse.paho.mqttv5.client.MqttAsyncClient client, org.eclipse.paho.mqttv5.common.MqttMessage message) -
Method Summary
Modifier and TypeMethodDescriptionvoidAcknowledges a message.intgetId()org.eclipse.paho.mqttv5.common.MqttMessagebyte[]org.eclipse.paho.mqttv5.common.packet.MqttPropertiesintgetQos()getTopic()booleanvoidsetPayload(byte[] payload) Sets the message payload.voidsetProperties(org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) voidsetQos(int qos) Sets the message qos.voidsetRetained(boolean retained) Sets the message to be retained.voidSets 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:
getPayloadin interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>- Returns:
- The message payload
-
setPayload
public void setPayload(byte[] payload) Description copied from interface:MqttBindingContextSets the message payload.- Specified by:
setPayloadin interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>- Parameters:
payload- The payload
-
isRetained
public boolean isRetained()- Specified by:
isRetainedin interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>- Returns:
- True if the message is retained
-
setRetained
public void setRetained(boolean retained) Description copied from interface:MqttBindingContextSets the message to be retained.- Specified by:
setRetainedin interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>- Parameters:
retained- The retained flag
-
getQos
public int getQos()- Specified by:
getQosin interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>- Returns:
- The message QOS
-
setQos
public void setQos(int qos) Description copied from interface:MqttBindingContextSets the message qos. Must be 0, 1, or 2.- Specified by:
setQosin interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>- Parameters:
qos- The qos
-
getTopic
- Specified by:
getTopicin interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>- Returns:
- The message topic
-
setTopic
Description copied from interface:MqttBindingContextSets the message topic.- Specified by:
setTopicin 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:
getIdin interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>- Returns:
- The message ID
-
acknowlege
public void acknowlege()Description copied from interface:MqttBindingContextAcknowledges a message.- Specified by:
acknowlegein interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
-
getNativeMessage
public org.eclipse.paho.mqttv5.common.MqttMessage getNativeMessage()- Specified by:
getNativeMessagein interfaceMqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>- Returns:
- The underlying message instance
-