Interface Mqtt3Publish

All Superinterfaces:
Mqtt3Message

@DoNotImplement public interface Mqtt3Publish extends Mqtt3Message
MQTT 3 Publish message. This message is translated from and to an MQTT 3 PUBLISH packet.
Since:
1.0
  • Field Details

    • DEFAULT_QOS

      @NotNull static final @NotNull MqttQos DEFAULT_QOS
      Default QoS level of a Publish message. It is chosen as MqttQos.AT_MOST_ONCE as the QoS level should be explicitly specified if special delivery guarantees are needed.
  • Method Details

    • builder

      @NotNull static @NotNull Mqtt3PublishBuilder builder()
      Creates a builder for a Publish message.
      Returns:
      the created builder.
    • getTopic

      @NotNull @NotNull MqttTopic getTopic()
      Returns:
      the topic of this Publish message.
    • getPayload

      @NotNull @NotNull Optional<ByteBuffer> getPayload()
      Returns:
      the optional payload of this Publish message.
    • getPayloadAsBytes

      byte @NotNull [] getPayloadAsBytes()
      Returns:
      the payload of this Publish message as a byte array. Empty byte array if the payload is not present.
    • getQos

      @NotNull @NotNull MqttQos getQos()
      Returns:
      the QoS of this Publish message.
    • isRetain

      boolean isRetain()
      Returns:
      whether this Publish message is a retained message.
    • acknowledge

      void acknowledge()
      Acknowledges this Publish message.
      Throws:
      UnsupportedOperationException - if manual acknowledgement is not enabled.
      IllegalStateException - if the message is acknowledged more than once.
      Since:
      1.2
    • getType

      @NotNull default @NotNull Mqtt3MessageType getType()
      Specified by:
      getType in interface Mqtt3Message
      Returns:
      the type of this MQTT message.
    • extend

      @NotNull Mqtt3PublishBuilder.Complete extend()
      Creates a builder for extending this Publish message.
      Returns:
      the created builder.