Package io.micronaut.mqtt.hivemq.v3.bind
Class MqttV3BindingContext
java.lang.Object
io.micronaut.mqtt.hivemq.v3.bind.MqttV3BindingContext
- All Implemented Interfaces:
MqttBindingContext<MqttMessage>
@Internal
public class MqttV3BindingContext
extends Object
implements MqttBindingContext<MqttMessage>
A binding context for MQTT v3 messages.
- Since:
- 3.0.0
- Author:
- Sven Kobow
-
Constructor Summary
ConstructorDescriptionMqttV3BindingContext
(com.hivemq.client.mqtt.mqtt3.Mqtt3AsyncClient client, MqttMessage message) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Acknowledges a message.int
getId()
byte[]
int
getQos()
getTopic()
boolean
void
setManualAcks
(boolean manualAcks) void
setMqtt3Publish
(com.hivemq.client.mqtt.mqtt3.message.publish.Mqtt3Publish mqtt3Publish) 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
-
MqttV3BindingContext
public MqttV3BindingContext(com.hivemq.client.mqtt.mqtt3.Mqtt3AsyncClient 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
-
setMqtt3Publish
public void setMqtt3Publish(com.hivemq.client.mqtt.mqtt3.message.publish.Mqtt3Publish mqtt3Publish) - Parameters:
mqtt3Publish
- The raw MQTT v3 publish paket
-