public interface MqttCallback
IMqttClient.setCallback(MqttCallback)
.Modifier and Type | Method and Description |
---|---|
void |
connectionLost(Throwable cause)
This method is called when the connection to the server is lost.
|
void |
messageArrived(String topic,
MqttMessage message)
This method is called when a message arrives from the server.
|
void connectionLost(Throwable cause)
cause
- the reason behind the loss of connection.void messageArrived(String topic, MqttMessage message) throws Exception
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.
topic
- name of the topic on the message was published to.message
- the actual message.Exception
- if a terminal error has occurred, and the client should be shut down.