Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d2b9d525
authored
Sep 22, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat:本地启动不订阅mq
parent
f96c1713
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
server-web/src/main/java/com/makeit/mqtt/MqttConfig.java
server-web/src/main/resources/application-dev.yml
server-web/src/main/resources/application-test.yml
server-web/src/main/java/com/makeit/mqtt/MqttConfig.java
View file @
d2b9d525
...
@@ -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
;
}
}
...
...
server-web/src/main/resources/application-dev.yml
View file @
d2b9d525
...
@@ -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
:
...
...
server-web/src/main/resources/application-test.yml
View file @
d2b9d525
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment