Interface Mqtt5Publish

All Superinterfaces:
Mqtt5Message
All Known Subinterfaces:
Mqtt5WillPublish

@DoNotImplement public interface Mqtt5Publish extends Mqtt5Message
MQTT 5 Publish message. This message is translated from and to an MQTT 5 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 Mqtt5PublishBuilder 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.
    • getMessageExpiryInterval

      @NotNull @NotNull OptionalLong getMessageExpiryInterval()
      Returns:
      the optional message expiry interval in seconds of this Publish message.
    • getPayloadFormatIndicator

      @NotNull @NotNull Optional<Mqtt5PayloadFormatIndicator> getPayloadFormatIndicator()
      Returns:
      the optional payload format indicator of this Publish message.
    • getContentType

      @NotNull @NotNull Optional<MqttUtf8String> getContentType()
      Returns:
      the optional content type of this Publish message.
    • getResponseTopic

      @NotNull @NotNull Optional<MqttTopic> getResponseTopic()
      Returns:
      the optional response topic of this Publish message.
    • getCorrelationData

      @NotNull @NotNull Optional<ByteBuffer> getCorrelationData()
      Returns:
      the optional correlation data of this Publish message.
    • getUserProperties

      @NotNull @NotNull Mqtt5UserProperties getUserProperties()
      Returns:
      the optional user properties of this Publish 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 Mqtt5MessageType getType()
      Specified by:
      getType in interface Mqtt5Message
      Returns:
      the type of this MQTT message.
    • asWill

      @NotNull @NotNull Mqtt5WillPublish asWill()
      Transforms this Publish message into a Will Publish with the same properties.
      Returns:
      the Will Publish.
    • extend

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