Interface MqttCallback


  • public interface MqttCallback
    Enables an application to be notified when asynchronous events related to the client occur. Classes implementing this interface can be registered using IMqttClient.setCallback(MqttCallback).
    • Method Detail

      • connectionLost

        void connectionLost​(Throwable cause)
        This method is called when the connection to the server is lost.
        Parameters:
        cause - the reason behind the loss of connection.
      • messageArrived

        void messageArrived​(String topic,
                            MqttMessage message)
                     throws Exception
        This method is called when a message arrives from the server.

        This method is invoked synchronously by the MQTT client.

        If an implementation of this method throws an Exception, then the client will be shut down.

        Any additional messages which arrive while an implementation of this method is running will back up on the network.

        Parameters:
        topic - name of the topic on the message was published to.
        message - the actual message.
        Throws:
        Exception - if a terminal error has occurred, and the client should be shut down.