Package 

Class MqttTopic


  • 
    public class MqttTopic
    
                        

    Represents a topic destination, used for publish/subscribe messaging.

    • Method Detail

      • getName

         String getName()

        Returns the name of the queue or topic.

      • publish

         MqttDeliveryToken publish(Array<byte> payload, int qos, boolean retained)

        Publishes a message on the topic. This is a convenience method, which will create a new MqttMessage object with a byte array payload and the specified QoS, and then publish it. All other values in the message will be set to the defaults.

        Parameters:
        payload - the byte array to use as the payload
        qos - the Quality of Service.
        retained - whether or not this message should be retained by the server.
      • publish

         MqttDeliveryToken publish(MqttMessage message)

        Publishes the specified message to this topic, but does not wait for delivery of the message to complete. The returned token can be used to track the delivery status of the message. Once this method has returned cleanly, the message has been accepted for publication by the client. Message delivery will be completed in the background when a connection is available.

        Parameters:
        message - the message to publish
      • toString

         String toString()

        Returns a string representation of this topic.

      • validate

         static void validate(String topicString, boolean wildcardAllowed)

        Validate the topic name or topic filter

        Parameters:
        topicString - topic name or filter
        wildcardAllowed - true if validate topic filter, false otherwise