|
|
@@ -211,7 +211,14 @@ public class MqttCore {
|
|
|
* @throws MqttException
|
|
|
*/
|
|
|
public void close() throws MqttException {
|
|
|
- this.mqttClient.close();
|
|
|
+ if (mqttClient.isConnected()) {
|
|
|
+ mqttClient.disconnect();
|
|
|
+ this.mqttClient.close();
|
|
|
+ log.info("【关闭MQTT连接成功】 connectionId: {}", connectionId);
|
|
|
+ }else{
|
|
|
+ log.info("【关闭MQTT连接失败:已关闭】 connectionId: {}", connectionId);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|