Class PublishResult


  • public class PublishResult
    extends java.lang.Object
    The type of data returned after calling Publish on an Mqtt5Client. The data contained varies depending on the publish and its configuration. Use getType() to figure out what type of data is contained and either getData() to get the data and cast it, or call getResult[Type name here]() to get the data already cast.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PublishResult.PublishResultType
      The type of data returned after calling Publish on an MQTT5 client.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PubAckPacket getResultPubAck()
      Returns the data contained in the PublishResult for a PublishResultType of PUBACK.
      PublishResult.PublishResultType getType()
      Returns the type of data that was returned after calling Publish on the Mqtt5Client.
      java.lang.Object getValue()
      Returns the data contained in the PubAck result.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getType

        public PublishResult.PublishResultType getType()
        Returns the type of data that was returned after calling Publish on the Mqtt5Client. You can use this information to determine what type of data is contained and either getData() to get the data and cast it, or call getResult[Type name here]() to get the data already cast.
        Returns:
        The type of data contained in the PublishResult
      • getValue

        public java.lang.Object getValue()
        Returns the data contained in the PubAck result. This is based on the PublishResultType, which is determined by the QoS setting in the published message. Note: To get the data type from this function, you will need to cast. For example, to get the PubAck from result type of PUBACK, you will need to use the following: PubAckPacket packet = (PubAckPacket)getValue()
        Returns:
        The data contained in the PublishResult result
      • getResultPubAck

        public PubAckPacket getResultPubAck()
        Returns the data contained in the PublishResult for a PublishResultType of PUBACK. This occurs for QoS 1 and will return a PubAckPacket.
        Returns:
        the data contained in the PublishResult for a PublishResultType of PUBACK.