Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
glinfo-api
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
林业通
glinfo-api
Commits
4f441cee
提交
4f441cee
authored
9月 26, 2022
作者:
linzhenjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加mqtt转socketio
上级
4e6492f0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
8 行增加
和
4 行删除
+8
-4
MqttGateway.java
...i/src/main/java/tech/glinfo/enbao/config/MqttGateway.java
+2
-0
MqttController.java
.../glinfo/enbao/modules/mqtt/controller/MqttController.java
+3
-3
application-prod.yml
appapi/src/main/resources/application-prod.yml
+3
-1
没有找到文件。
appapi/src/main/java/tech/glinfo/enbao/config/MqttGateway.java
浏览文件 @
4f441cee
...
...
@@ -8,4 +8,5 @@ import org.springframework.messaging.handler.annotation.Header;
@MessagingGateway
(
defaultRequestChannel
=
"mqttOutboundChannel"
)
public
interface
MqttGateway
{
void
sendToMqtt
(
String
data
,
@Header
(
MqttHeaders
.
TOPIC
)
String
topic
);
void
sendToMqtt
(
byte
[]
data
,
@Header
(
MqttHeaders
.
TOPIC
)
String
topic
);
}
\ No newline at end of file
appapi/src/main/java/tech/glinfo/enbao/modules/mqtt/controller/MqttController.java
浏览文件 @
4f441cee
package
tech
.
glinfo
.
enbao
.
modules
.
mqtt
.
controller
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -9,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
tech.glinfo.enbao.common.annotation.Login
;
import
tech.glinfo.enbao.common.
contants.Constant
s
;
import
tech.glinfo.enbao.common.
utils.ByteUtil
s
;
import
tech.glinfo.enbao.common.utils.EncryptUtil
;
import
tech.glinfo.enbao.common.utils.R
;
import
tech.glinfo.enbao.common.utils.StringUtils
;
...
...
@@ -45,7 +44,8 @@ public class MqttController {
String
topic
=
params
.
get
(
"topic"
);
if
(!
StringUtils
.
isBlank
(
data
,
topic
))
{
log
.
info
(
"\nsend message >>>> topic : {}, data : {}"
,
topic
,
data
);
mqttGateway
.
sendToMqtt
(
data
,
topic
);
byte
[]
datas
=
ByteUtils
.
hexStrToBinaryStr
(
data
);
mqttGateway
.
sendToMqtt
(
datas
,
topic
);
}
return
R
.
ok
();
}
...
...
appapi/src/main/resources/application-prod.yml
浏览文件 @
4f441cee
...
...
@@ -45,7 +45,9 @@ spring:
max-active
:
1000
# 连接池最大连接数(使用负值表示没有限制)
max-wait
:
-1ms
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle
:
10
# 连接池中的最大空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连
接池中的最小空闲连接
#MQ配置
activemq
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论