From 31290bdc487e80c26b2e81d55e46ca27d80e385c Mon Sep 17 00:00:00 2001
From: wangmengzhao <1036088376@qq.com>
Date: 星期二, 28 十一月 2023 23:46:02 +0800
Subject: [PATCH] 设备安装单/维修单优化,一级联营商合伙人登录之后可以看到别人给他创建的安装单和他给别人创建的安装单20231128wmz
---
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/mqtt/EmqxClient.java | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/mqtt/EmqxClient.java b/wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/mqtt/EmqxClient.java
index 519e048..e265cbc 100644
--- a/wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/mqtt/EmqxClient.java
+++ b/wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/mqtt/EmqxClient.java
@@ -157,9 +157,13 @@
* 閲嶆柊杩炴帴MQTT
*/
public synchronized void refresh() {
+ //鏂紑涓巑qtt鐨勮繛鎺�
disconnect();
+ //璁剧疆杩炴帴灞炴��
setOptions();
+ //鍒涘缓瀹㈡埛绔�
createClient();
+ //杩炴帴MQTT鏈嶅姟鍣�
connect();
}
@@ -174,12 +178,15 @@
*/
public void publish(int qos, boolean retained, String topic, String pushMessage) {
logger.info("鍙戝竷涓婚" + topic);
+ //鍒涘缓MqttMessage瀵硅薄
MqttMessage message = new MqttMessage();
+ //璁剧疆娑堟伅鐨勫唴瀹�
message.setQos(qos);
message.setRetained(retained);
message.setPayload(pushMessage.getBytes());
try {
+ //mqttclient閲岄潰鐨勫彂甯冩秷鎭�
IMqttDeliveryToken token = client.publish(topic, message);
token.waitForCompletion();
} catch (MqttPersistenceException e) {
@@ -201,6 +208,7 @@
public void subscribe(String topic, int qos) {
logger.info("=======>>>>>璁㈤槄浜嗕富棰� topic={}", topic);
try {
+ //璁㈤槄涓婚鐨勬柟娉�
IMqttToken token = client.subscribe(topic, qos);
token.waitForCompletion();
} catch (MqttException e) {
--
Gitblit v1.8.0