Package io.micronaut.mqtt.hivemq.v5.bind
Class MqttV5BindingContext
java.lang.Object
io.micronaut.mqtt.hivemq.v5.bind.MqttV5BindingContext
- All Implemented Interfaces:
MqttBindingContext<MqttMessage>
@Internal
public final class MqttV5BindingContext
extends Object
implements MqttBindingContext<MqttMessage>
A binding context for MQTT v5 messages.
- Since:
- 3.0.0
- Author:
- Sven Kobow
-
Constructor Summary
ConstructorDescriptionMqttV5BindingContext
(com.hivemq.client.mqtt.mqtt5.Mqtt5AsyncClient client, MqttMessage message) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Acknowledges a message.int
getId()
byte[]
int
getQos()
getTopic()
boolean
void
setManualAcks
(boolean manualAcks) void
setMqtt5Publish
(com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5Publish mqtt5Publish) void
setPayload
(byte[] payload) Sets the message payload.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(com.hivemq.client.mqtt.mqtt5.Mqtt5AsyncClient client, MqttMessage message) - Parameters:
client
- The clientmessage
- The message
-
-
Method Details
-
getPayload
public byte[] getPayload()- Specified by:
getPayload
in interfaceMqttBindingContext<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<MqttMessage>
- Parameters:
payload
- The payload
-
isRetained
public boolean isRetained()- Specified by:
isRetained
in interfaceMqttBindingContext<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<MqttMessage>
- Parameters:
retained
- The retained flag
-
getQos
public int getQos()- Specified by:
getQos
in interfaceMqttBindingContext<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<MqttMessage>
- Parameters:
qos
- The qos
-
getTopic
- Specified by:
getTopic
in interfaceMqttBindingContext<MqttMessage>
- Returns:
- The message topic
-
setTopic
Description copied from interface:MqttBindingContext
Sets the message topic.- Specified by:
setTopic
in interfaceMqttBindingContext<MqttMessage>
- Parameters:
topic
- The topic
-
getId
public int getId()- Specified by:
getId
in interfaceMqttBindingContext<MqttMessage>
- Returns:
- The message ID
-
acknowlege
public void acknowlege()Description copied from interface:MqttBindingContext
Acknowledges a message.- Specified by:
acknowlege
in interfaceMqttBindingContext<MqttMessage>
-
getNativeMessage
- Specified by:
getNativeMessage
in interfaceMqttBindingContext<MqttMessage>
- Returns:
- The underlying message instance
-
setManualAcks
public void setManualAcks(boolean manualAcks) - Parameters:
manualAcks
- If messages should be acknowledged manually
-
setMqtt5Publish
public void setMqtt5Publish(com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5Publish mqtt5Publish) - Parameters:
mqtt5Publish
- The raw MQTT v5 publish paket
-