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 Details

    • MqttV5BindingContext

      public MqttV5BindingContext(org.eclipse.paho.mqttv5.client.MqttAsyncClient client, org.eclipse.paho.mqttv5.common.MqttMessage message)
      Parameters:
      client - The client
      message - The message
  • Method Details

    • getPayload

      public byte[] getPayload()
      Specified by:
      getPayload in interface MqttBindingContext<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 interface MqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
      Parameters:
      payload - The payload
    • isRetained

      public boolean isRetained()
      Specified by:
      isRetained in interface MqttBindingContext<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 interface MqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
      Parameters:
      retained - The retained flag
    • getQos

      public int getQos()
      Specified by:
      getQos in interface MqttBindingContext<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 interface MqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
      Parameters:
      qos - The qos
    • getTopic

      public String getTopic()
      Specified by:
      getTopic in interface MqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
      Returns:
      The message topic
    • setTopic

      public void setTopic(String topic)
      Description copied from interface: MqttBindingContext
      Sets the message topic.
      Specified by:
      setTopic in interface MqttBindingContext<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 interface MqttBindingContext<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 interface MqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
    • getNativeMessage

      public org.eclipse.paho.mqttv5.common.MqttMessage getNativeMessage()
      Specified by:
      getNativeMessage in interface MqttBindingContext<org.eclipse.paho.mqttv5.common.MqttMessage>
      Returns:
      The underlying message instance