Commit d2b9d525 by huangjy

feat:本地启动不订阅mq

parent f96c1713
......@@ -24,6 +24,7 @@ public class MqttConfig {
private String defaultTopic;
private int timeout;
private int keepalive;
private Boolean msgSwitch;
public MqttConfig() {
super();
......@@ -44,6 +45,9 @@ public class MqttConfig {
@Bean
public MqttPushClient getMqttPushClient() {
if (!msgSwitch) {
return null;
}
clientId = StringUtils.isNotEmpty(clientId) ? clientId : iotTokenService.getIotToken();
mqttPushClient.connect(hostUrl, clientId, username, password, timeout, keepalive);
// 订阅主题
......@@ -51,6 +55,14 @@ public class MqttConfig {
return mqttPushClient;
}
public Boolean getMsgSwitch() {
return msgSwitch;
}
public void setMsgSwitch(Boolean msgSwitch) {
this.msgSwitch = msgSwitch;
}
public String getUsername() {
return username;
}
......
......@@ -119,6 +119,7 @@ mqtt:
defaultTopic: /device/*/*/**
timeout: 10
keepalive: 60
msgSwitch: false
wx:
miniapp:
......
......@@ -116,6 +116,7 @@ mqtt:
defaultTopic: /device/*/*/**
timeout: 10
keepalive: 60
msgSwitch: true
wx:
miniapp:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment