Commit d2b9d525 by huangjy

feat:本地启动不订阅mq

parent f96c1713
...@@ -24,6 +24,7 @@ public class MqttConfig { ...@@ -24,6 +24,7 @@ public class MqttConfig {
private String defaultTopic; private String defaultTopic;
private int timeout; private int timeout;
private int keepalive; private int keepalive;
private Boolean msgSwitch;
public MqttConfig() { public MqttConfig() {
super(); super();
...@@ -44,6 +45,9 @@ public class MqttConfig { ...@@ -44,6 +45,9 @@ public class MqttConfig {
@Bean @Bean
public MqttPushClient getMqttPushClient() { public MqttPushClient getMqttPushClient() {
if (!msgSwitch) {
return null;
}
clientId = StringUtils.isNotEmpty(clientId) ? clientId : iotTokenService.getIotToken(); clientId = StringUtils.isNotEmpty(clientId) ? clientId : iotTokenService.getIotToken();
mqttPushClient.connect(hostUrl, clientId, username, password, timeout, keepalive); mqttPushClient.connect(hostUrl, clientId, username, password, timeout, keepalive);
// 订阅主题 // 订阅主题
...@@ -51,6 +55,14 @@ public class MqttConfig { ...@@ -51,6 +55,14 @@ public class MqttConfig {
return mqttPushClient; return mqttPushClient;
} }
public Boolean getMsgSwitch() {
return msgSwitch;
}
public void setMsgSwitch(Boolean msgSwitch) {
this.msgSwitch = msgSwitch;
}
public String getUsername() { public String getUsername() {
return username; return username;
} }
......
...@@ -119,6 +119,7 @@ mqtt: ...@@ -119,6 +119,7 @@ mqtt:
defaultTopic: /device/*/*/** defaultTopic: /device/*/*/**
timeout: 10 timeout: 10
keepalive: 60 keepalive: 60
msgSwitch: false
wx: wx:
miniapp: miniapp:
......
...@@ -116,6 +116,7 @@ mqtt: ...@@ -116,6 +116,7 @@ mqtt:
defaultTopic: /device/*/*/** defaultTopic: /device/*/*/**
timeout: 10 timeout: 10
keepalive: 60 keepalive: 60
msgSwitch: true
wx: wx:
miniapp: 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