Package org.eclipse.paho.client.mqttv3
Interface MqttCallback
-
public interface MqttCallbackEnables an application to be notified when asynchronous events related to the client occur. Classes implementing this interface can be registered usingIMqttClient.setCallback(MqttCallback).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidconnectionLost(Throwable cause)This method is called when the connection to the server is lost.voidmessageArrived(String topic, MqttMessage message)This method is called when a message arrives from the server.
-
-
-
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.
-
-