From 44f2a0a32c096bdb05d4cc0ac162cdc1eb14c3ed Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期四, 10 八月 2023 13:14:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java
index 3c36909..37a4a18 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java
@@ -22,7 +22,7 @@
@Override
public void run(ApplicationArguments args) {
- log.info("鍒濆鍖栧苟鍚姩mqtt......");
+ log.debug("鍒濆鍖栧苟鍚姩mqtt......");
if(PropertiesUtil.MQTT_ENABLED)
{
this.connect();
@@ -56,7 +56,7 @@
if (null == client) {
client = new MqttClient(PropertiesUtil.MQTT_HOST, PropertiesUtil.MQTT_CLIENT_ID, new MemoryPersistence());
}
- log.info("--鍒涘缓mqtt瀹㈡埛绔�");
+ log.debug("--鍒涘缓mqtt瀹㈡埛绔�");
} catch (Exception e) {
log.error("鍒涘缓mqtt瀹㈡埛绔紓甯革細" + e);
}
@@ -75,8 +75,8 @@
// 璁剧疆浼氳瘽蹇冭烦鏃堕棿
options.setKeepAliveInterval(PropertiesUtil.MQTT_KEEP_ALIVE);
// 鏄惁娓呴櫎session
- options.setCleanSession(false);
- log.info("--鐢熸垚mqtt閰嶇疆瀵硅薄");
+ options.setCleanSession(true);
+ log.debug("--鐢熸垚mqtt閰嶇疆瀵硅薄");
return options;
}
@@ -96,7 +96,7 @@
*/
qos[i] = 1;
}
- log.info("--璁剧疆娑堟伅鍙戝竷璐ㄩ噺");
+ log.debug("--璁剧疆娑堟伅鍙戝竷璐ㄩ噺");
return qos;
}
@@ -106,10 +106,10 @@
public void create(MqttConnectOptions options, String[] topic, int[] qos) {
try {
client.setCallback(new MqttConsumerCallback(client, options, topic, qos));
- log.info("--娣诲姞鍥炶皟澶勭悊绫�");
+ log.debug("--娣诲姞鍥炶皟澶勭悊绫�");
client.connect(options);
} catch (Exception e) {
- log.info("瑁呰浇瀹炰緥鎴栬闃呬富棰樺紓甯革細" + e);
+ log.error("瑁呰浇瀹炰緥鎴栬闃呬富棰樺紓甯革細" + e);
}
}
@@ -121,7 +121,7 @@
*/
public void subscribe(String topic, int qos) {
try {
- log.info("topic:" + topic);
+ log.debug("topic:" + topic);
client.subscribe(topic, qos);
} catch (MqttException e) {
e.printStackTrace();
@@ -144,7 +144,7 @@
* 鍙戝竷
*/
public static void publish(int qos, boolean retained, String topic, String pushMessage) {
- log.info("銆愪富棰樸��:" + topic + "銆恞os銆�:" + qos + "銆恜ushMessage銆�:" + pushMessage);
+ log.debug("銆愪富棰樸��:" + topic + "銆恞os銆�:" + qos + "銆恜ushMessage銆�:" + pushMessage);
MqttMessage message = new MqttMessage();
message.setQos(qos);
message.setRetained(retained);
@@ -162,7 +162,7 @@
token = mTopic.publish(message);
token.waitForCompletion();
if (token.isComplete()) {
- log.info("娑堟伅鍙戦�佹垚鍔�");
+ log.debug("娑堟伅鍙戦�佹垚鍔�");
}
} catch (MqttPersistenceException e) {
e.printStackTrace();
--
Gitblit v1.9.3