Class PublishResult

java.lang.Object
org.mqtt4j.hato.PublishResult

public final class PublishResult extends Object
Successful completion of a publication: the transport write for QoS 0, receipt of PUBACK for QoS 1, or receipt of PUBCOMP for QoS 2. None confirms completion of any subscriber's application processing.
  • Method Details

    • of

      public static PublishResult of()
      Describes a successfully completed publication with ReasonCode.SUCCESS.
      Returns:
      a result whose [#reasonCode()] is [ReasonCode#SUCCESS]
      
    • of

      public static PublishResult of(ReasonCode reasonCode)
      Describes a successfully completed publication with reasonCode.
      Parameters:
      reasonCode - the reason code of the broker's acknowledgement
      Returns:
      a result whose [#reasonCode()] is `reasonCode`
      
      Throws:
      IllegalArgumentException -
      unless `reasonCode` is [ReasonCode#SUCCESS] or [ReasonCode#NO_MATCHING_SUBSCRIBERS]
      
    • reasonCode

      public ReasonCode reasonCode()
      Returns the reason code of the MQTT 5.0 broker's acknowledgement: that of PUBACK for QoS 1, and that of PUBREC for QoS 2. ReasonCode.NO_MATCHING_SUBSCRIBERS means that the broker accepted the message but had no subscription to deliver it to. Brokers may also report ReasonCode.SUCCESS in that case. QoS 0 and MQTT 3.1.1 report ReasonCode.SUCCESS.
      Returns:
      the reason code of the MQTT 5.0 broker's acknowledgement: that of PUBACK for QoS 1, and that of PUBREC for QoS 2
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object