Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
d010aee3
Commit
d010aee3
authored
Jul 29, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改MQTT消息策略
parent
7703347b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+3
-0
MqttConfig.java
share-system/src/main/java/share/system/mqtt/MqttConfig.java
+1
-3
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
d010aee3
...
...
@@ -417,6 +417,9 @@ public class RedisTask {
dvo
.
setRefreshNum
(
dvo
.
getRefreshNum
()
+
1
);
// 将失败的消息放到redis最后重新发送
redisUtil
.
lPush
(
key2
,
dvo
);
//次数超过3次,删除
}
else
if
(
dvo
!=
null
&&
dvo
.
getRefreshNum
()
>=
3
)
{
redisUtil
.
getRightPop
(
key2
,
10L
);
}
// 获取当前需要发送的消息
Object
data
=
redisUtil
.
getIndex
(
key2
,
-
1
);
...
...
share-system/src/main/java/share/system/mqtt/MqttConfig.java
View file @
d010aee3
...
...
@@ -15,7 +15,6 @@ import org.springframework.integration.core.MessageProducer;
import
org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory
;
import
org.springframework.integration.mqtt.core.MqttPahoClientFactory
;
import
org.springframework.integration.mqtt.event.MqttConnectionFailedEvent
;
import
org.springframework.integration.mqtt.event.MqttMessageDeliveredEvent
;
import
org.springframework.integration.mqtt.event.MqttMessageSentEvent
;
import
org.springframework.integration.mqtt.event.MqttSubscribedEvent
;
import
org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter
;
...
...
@@ -23,7 +22,6 @@ import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
import
org.springframework.messaging.MessageChannel
;
import
org.springframework.messaging.MessageHandler
;
import
javax.annotation.Resource
;
import
java.util.Date
;
...
...
@@ -154,7 +152,7 @@ public class MqttConfig {
//接收字节数组类型有效荷载
defaultPahoMessageConverter
.
setPayloadAsBytes
(
true
);
adapter
.
setConverter
(
defaultPahoMessageConverter
);
adapter
.
setQos
(
2
);
adapter
.
setQos
(
0
);
adapter
.
setOutputChannel
(
mqttInputChannel
());
return
adapter
;
}
...
...
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