Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
quickmsg
smqtt
提交
3ac93bcc
S
smqtt
项目概览
quickmsg
/
smqtt
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
smqtt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3ac93bcc
编写于
4月 26, 2021
作者:
L
luxurong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cancel relay update
上级
ae1b72d2
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
123 addition
and
40 deletion
+123
-40
README.md
README.md
+60
-1
smqtt-bootstrap/pom.xml
smqtt-bootstrap/pom.xml
+0
-1
smqtt-bootstrap/src/main/java/com/github/quickmsg/AbstractStarter.java
...ap/src/main/java/com/github/quickmsg/AbstractStarter.java
+2
-0
smqtt-bootstrap/src/test/java/com/github/quickmsg/BootstrapTest.java
...trap/src/test/java/com/github/quickmsg/BootstrapTest.java
+25
-7
smqtt-common/src/main/java/com/github/quickmsg/common/bootstrap/BootstrapKey.java
...va/com/github/quickmsg/common/bootstrap/BootstrapKey.java
+1
-1
smqtt-common/src/main/java/com/github/quickmsg/common/channel/MqttChannel.java
.../java/com/github/quickmsg/common/channel/MqttChannel.java
+17
-14
smqtt-common/src/main/java/com/github/quickmsg/common/topic/TopicRegistry.java
.../java/com/github/quickmsg/common/topic/TopicRegistry.java
+1
-1
smqtt-core/src/main/java/com/github/quickmsg/core/Bootstrap.java
...ore/src/main/java/com/github/quickmsg/core/Bootstrap.java
+1
-1
smqtt-core/src/main/java/com/github/quickmsg/core/DefaultMessageRegistry.java
...java/com/github/quickmsg/core/DefaultMessageRegistry.java
+1
-1
smqtt-core/src/main/java/com/github/quickmsg/core/DefaultTopicRegistry.java
...n/java/com/github/quickmsg/core/DefaultTopicRegistry.java
+2
-2
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/CommonProtocol.java
...ava/com/github/quickmsg/core/protocol/CommonProtocol.java
+3
-3
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/ConnectAckProtocol.java
...com/github/quickmsg/core/protocol/ConnectAckProtocol.java
+1
-1
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/ConnectProtocol.java
...va/com/github/quickmsg/core/protocol/ConnectProtocol.java
+3
-2
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/PublishAckProtocol.java
...com/github/quickmsg/core/protocol/PublishAckProtocol.java
+1
-1
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/PublishProtocol.java
...va/com/github/quickmsg/core/protocol/PublishProtocol.java
+0
-1
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/SubscribeAckProtocol.java
...m/github/quickmsg/core/protocol/SubscribeAckProtocol.java
+1
-1
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/UnSubscribeAckProtocol.java
...github/quickmsg/core/protocol/UnSubscribeAckProtocol.java
+1
-1
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/UnSubscribeProtocol.java
...om/github/quickmsg/core/protocol/UnSubscribeProtocol.java
+3
-1
smqtt-core/src/main/resources/META-INF/services/com.github.quickmsg.common.http.HttpActor
...TA-INF/services/com.github.quickmsg.common.http.HttpActor
+0
-0
smqtt-core/src/main/resources/META-INF/services/com.github.quickmsg.common.interceptor.Interceptor
...rvices/com.github.quickmsg.common.interceptor.Interceptor
+0
-0
smqtt-core/src/main/resources/META-INF/services/com.github.quickmsg.common.protocol.Protocol
...INF/services/com.github.quickmsg.common.protocol.Protocol
+0
-0
未找到文件。
README.md
浏览文件 @
3ac93bcc
...
...
@@ -2,7 +2,7 @@
## SMQTT是一款开源的MQTT消息代理Broker,
SMQTT基于Netty开发,底层采用Reactor3反应堆模型,支持单机部署,支持容器化部署,
SMQTT基于Netty开发,底层采用Reactor3反应堆模型,支持
插拔式接口,支持
单机部署,支持容器化部署,
### smqtt目前拥有的功能如下:
1.
消息质量等级实现(支持qos0,qos1,qos2)
...
...
@@ -32,6 +32,65 @@ SMQTT基于Netty开发,底层采用Reactor3反应堆模型,支持单机部署
## 快速开始
-
main方式启动
引入依赖
```
markdown
Bootstrap.builder()
.port(8555)
.websocketPort(8999)
.options(channelOptionMap -> {})
.ssl(false)
.sslContext(new SslContext("crt","key"))
.isWebsocket(true)
.wiretap(false)
.httpOptions(Bootstrap.HttpOptions.builder().ssl(false).httpPort(62212).accessLog(true).build())
.build()
.startAwait();
```
阻塞式启动服务:
```
markdown
Bootstrap.builder()
.port(8555)
.websocketPort(8999)
.options(channelOptionMap -> {})
.ssl(false)
.sslContext(new SslContext("crt","key"))
.isWebsocket(true)
.wiretap(false)
.httpOptions(Bootstrap.HttpOptions.builder().ssl(false).httpPort(62212).accessLog(true).build())
.build()
.startAwait();
```
非阻塞式启动服务:
```
markdown
Bootstrap.builder()
.port(8555)
.websocketPort(8999)
.options(channelOptionMap -> {})
.ssl(false)
.sslContext(new SslContext("crt","key"))
.isWebsocket(true)
.wiretap(false)
.httpOptions(Bootstrap.HttpOptions.builder().ssl(false).httpPort(62212).accessLog(true).build())
.build()
.startAwait();
```
-- jar方式
-
docker 方式
...
...
smqtt-bootstrap/pom.xml
浏览文件 @
3ac93bcc
...
...
@@ -24,7 +24,6 @@
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
</dependency>
...
...
smqtt-bootstrap/src/main/java/com/github/quickmsg/AbstractStarter.java
浏览文件 @
3ac93bcc
package
com.github.quickmsg
;
import
com.github.quickmsg.common.bootstrap.BootstrapKey
;
import
com.github.quickmsg.common.config.SslContext
;
import
com.github.quickmsg.common.utils.PropertiesLoader
;
import
com.github.quickmsg.core.Bootstrap
;
import
io.netty.channel.WriteBufferWaterMark
;
import
java.util.Map
;
...
...
smqtt-bootstrap/src/test/java/com/github/quickmsg/BootstrapTest.java
浏览文件 @
3ac93bcc
package
com.github.quickmsg
;
import
com.github.quickmsg.common.config.SslContext
;
import
com.github.quickmsg.core.Bootstrap
;
import
org.junit.Test
;
import
reactor.core.publisher.Sinks
;
/**
* Unit test for simple App.
...
...
@@ -11,18 +12,35 @@ public class BootstrapTest {
* Rigorous Test :-)
*/
@Test
public
void
TestBootstrap
()
{
public
void
TestBootstrap
()
throws
InterruptedException
{
Bootstrap
.
builder
()
// Bootstrap.builder()
// .port(8555)
// .websocketPort(8999)
// .options(channelOptionMap -> {})
// .ssl(false)
// .sslContext(new SslContext("crt","key"))
// .isWebsocket(true)
// .wiretap(false)
// .httpOptions(Bootstrap.HttpOptions.builder().ssl(false).httpPort(62212).accessLog(true).build())
// .build()
// .startAwait();
// 启动服务
Bootstrap
bootstrap
=
Bootstrap
.
builder
()
.
port
(
8555
)
.
websocketPort
(
8999
)
// .options(channelOptionMap -> channelOptionMap.put()
)
.
options
(
channelOptionMap
->
{}
)
.
ssl
(
false
)
.
sslContext
(
new
SslContext
(
"crt"
,
"key"
))
.
isWebsocket
(
true
)
.
wiretap
(
fals
e
)
.
httpOptions
(
Bootstrap
.
HttpOptions
.
builder
().
httpPort
(
62212
).
accessLog
(
true
).
build
())
.
wiretap
(
tru
e
)
.
httpOptions
(
Bootstrap
.
HttpOptions
.
builder
().
ssl
(
false
).
httpPort
(
62212
).
accessLog
(
true
).
build
())
.
build
()
.
startAwait
();
.
start
().
block
();
assert
bootstrap
!=
null
;
// 关闭服务
// bootstrap.shutdown();
Thread
.
sleep
(
1000000
);
}
}
smqtt-
bootstrap/src/main/java/com/github/quickmsg
/BootstrapKey.java
→
smqtt-
common/src/main/java/com/github/quickmsg/common/bootstrap
/BootstrapKey.java
浏览文件 @
3ac93bcc
package
com.github.quickmsg
;
package
com.github.quickmsg
.common.bootstrap
;
/**
* @author luxurong
...
...
smqtt-common/src/main/java/com/github/quickmsg/common/channel/MqttChannel.java
浏览文件 @
3ac93bcc
...
...
@@ -12,11 +12,11 @@ import reactor.core.publisher.Mono;
import
reactor.netty.Connection
;
import
java.time.Duration
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.CopyOnWriteArray
Lis
t
;
import
java.util.concurrent.CopyOnWriteArray
Se
t
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
...
...
@@ -44,7 +44,7 @@ public class MqttChannel {
private
long
keepalive
;
private
Lis
t
<
String
>
topics
;
private
Se
t
<
String
>
topics
;
private
Boolean
isMock
=
false
;
...
...
@@ -55,12 +55,12 @@ public class MqttChannel {
private
Map
<
Integer
,
MqttPublishMessage
>
qos2MsgCache
;
private
Map
<
Integer
,
Disposable
>
replyMqttMessageMap
;
private
Map
<
MqttMessageType
,
Map
<
Integer
,
Disposable
>
>
replyMqttMessageMap
;
public
static
MqttChannel
init
(
Connection
connection
)
{
MqttChannel
mqttChannel
=
new
MqttChannel
();
mqttChannel
.
setTopics
(
new
CopyOnWriteArray
Lis
t
<>());
mqttChannel
.
setTopics
(
new
CopyOnWriteArray
Se
t
<>());
mqttChannel
.
setAtomicInteger
(
new
AtomicInteger
(
0
));
mqttChannel
.
setReplyMqttMessageMap
(
new
ConcurrentHashMap
<>());
mqttChannel
.
setMqttMessageSink
(
new
MqttMessageSink
());
...
...
@@ -158,23 +158,25 @@ public class MqttChannel {
/**
* 取消重发
*
* @param type type
* @param messageId 消息Id
* @return boolean状态
*/
public
Mono
<
Void
>
cancelRetry
(
Integer
messageId
)
{
return
Mono
.
fromRunnable
(()
->
this
.
removeReply
(
messageId
));
public
Mono
<
Void
>
cancelRetry
(
MqttMessageType
type
,
Integer
messageId
)
{
return
Mono
.
fromRunnable
(()
->
this
.
removeReply
(
type
,
messageId
));
}
/**
* remove resend action
*
* @param type type
* @param messageId messageId
* @return void
*/
private
void
removeReply
(
Integer
messageId
)
{
Optional
.
ofNullable
(
replyMqttMessageMap
.
get
(
messageId
))
private
void
removeReply
(
MqttMessageType
type
,
Integer
messageId
)
{
Optional
.
ofNullable
(
replyMqttMessageMap
.
get
(
type
))
.
map
(
messageIds
->
messageIds
.
remove
(
messageId
))
.
ifPresent
(
Disposable:
:
dispose
);
replyMqttMessageMap
.
remove
(
messageId
);
}
...
...
@@ -194,7 +196,7 @@ public class MqttChannel {
private
void
clear
()
{
replyMqttMessageMap
.
values
().
forEach
(
Disposable:
:
dispose
);
replyMqttMessageMap
.
values
().
forEach
(
maps
->
maps
.
values
().
forEach
(
Disposable:
:
dispose
)
);
replyMqttMessageMap
.
clear
();
}
...
...
@@ -209,7 +211,7 @@ public class MqttChannel {
public
static
MqttMessageSink
MQTT_SINK
=
new
MqttMessageSink
();
public
Mono
<
Void
>
sendMessage
(
MqttMessage
mqttMessage
,
MqttChannel
mqttChannel
,
boolean
retry
,
Map
<
Integer
,
Disposable
>
replyMqttMessageMap
)
{
public
Mono
<
Void
>
sendMessage
(
MqttMessage
mqttMessage
,
MqttChannel
mqttChannel
,
boolean
retry
,
Map
<
MqttMessageType
,
Map
<
Integer
,
Disposable
>
>
replyMqttMessageMap
)
{
log
.
info
(
"write channel {} message {}"
,
mqttChannel
.
getConnection
(),
mqttMessage
);
if
(
retry
)
{
/*
...
...
@@ -266,9 +268,10 @@ public class MqttChannel {
* @param replyMqttMessageMap
* @return Mono
*/
public
Mono
<
Void
>
offerReply
(
MqttMessage
message
,
final
MqttChannel
mqttChannel
,
final
int
messageId
,
Map
<
Integer
,
Disposable
>
replyMqttMessageMap
)
{
public
Mono
<
Void
>
offerReply
(
MqttMessage
message
,
final
MqttChannel
mqttChannel
,
final
int
messageId
,
Map
<
MqttMessageType
,
Map
<
Integer
,
Disposable
>>
replyMqttMessageMap
)
{
return
Mono
.
fromRunnable
(()
->
replyMqttMessageMap
.
put
(
messageId
,
replyMqttMessageMap
.
computeIfAbsent
(
message
.
fixedHeader
().
messageType
(),
mqttMessageType
->
new
ConcurrentHashMap
<>(
8
)).
put
(
messageId
,
mqttChannel
.
write
(
Mono
.
just
(
message
))
.
delaySubscription
(
Duration
.
ofSeconds
(
5
))
.
repeat
()
...
...
smqtt-common/src/main/java/com/github/quickmsg/common/topic/TopicRegistry.java
浏览文件 @
3ac93bcc
...
...
@@ -43,7 +43,7 @@ public interface TopicRegistry {
* @param mqttChannel 通道信息
* @return Void
*/
void
clear
(
Lis
t
<
String
>
topics
,
MqttChannel
mqttChannel
);
void
clear
(
Se
t
<
String
>
topics
,
MqttChannel
mqttChannel
);
/**
* 获取topic的channels
...
...
smqtt-
bootstrap/src/main/java/com/github/quickmsg
/Bootstrap.java
→
smqtt-
core/src/main/java/com/github/quickmsg/core
/Bootstrap.java
浏览文件 @
3ac93bcc
package
com.github.quickmsg
;
package
com.github.quickmsg
.core
;
import
com.github.quickmsg.core.http.HttpTransportFactory
;
import
com.github.quickmsg.common.auth.PasswordAuthentication
;
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/DefaultMessageRegistry.java
浏览文件 @
3ac93bcc
...
...
@@ -61,7 +61,7 @@ public class DefaultMessageRegistry implements MessageRegistry {
retainMessage
.
getMqttQoS
(),
retainMessage
.
getMqttQoS
()
==
MqttQoS
.
AT_MOST_ONCE
?
0
:
mqttChannel
.
generateMessageId
(),
key
,
retainMessage
.
getByteBuf
());
retainMessage
.
getByteBuf
()
.
copy
()
);
}).
collect
(
Collectors
.
toList
()));
}
else
{
return
Optional
.
empty
();
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/DefaultTopicRegistry.java
浏览文件 @
3ac93bcc
...
...
@@ -30,12 +30,12 @@ public class DefaultTopicRegistry implements TopicRegistry {
@Override
public
void
clear
(
MqttChannel
mqttChannel
)
{
Lis
t
<
String
>
topics
=
mqttChannel
.
getTopics
();
Se
t
<
String
>
topics
=
mqttChannel
.
getTopics
();
this
.
clear
(
topics
,
mqttChannel
);
}
@Override
public
void
clear
(
Lis
t
<
String
>
topics
,
MqttChannel
mqttChannel
)
{
public
void
clear
(
Se
t
<
String
>
topics
,
MqttChannel
mqttChannel
)
{
for
(
String
topic
:
topics
)
{
topicChannels
.
get
(
TopicRegexUtils
.
regexTopic
(
topic
)).
remove
(
mqttChannel
);
}
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/CommonProtocol.java
浏览文件 @
3ac93bcc
...
...
@@ -51,7 +51,7 @@ public class CommonProtocol implements Protocol<MqttMessage> {
case
PUBREC:
MqttMessageIdVariableHeader
messageIdVariableHeader
=
(
MqttMessageIdVariableHeader
)
message
.
variableHeader
();
int
messageId
=
messageIdVariableHeader
.
messageId
();
return
mqttChannel
.
cancelRetry
(
messageId
)
return
mqttChannel
.
cancelRetry
(
MqttMessageType
.
PUBLISH
,
messageId
)
.
then
(
mqttChannel
.
write
(
MqttMessageBuilder
.
buildPublishRel
(
messageId
),
true
));
case
PUBREL:
MqttMessageIdVariableHeader
relMessageIdVariableHeader
=
(
MqttMessageIdVariableHeader
)
message
.
variableHeader
();
...
...
@@ -65,14 +65,14 @@ public class CommonProtocol implements Protocol<MqttMessage> {
mqttChannels
.
stream
()
.
map
(
channel
->
channel
.
write
(
MessageUtils
.
wrapPublishMessage
(
msg
,
channel
.
generateMessageId
()),
true
))
.
collect
(
Collectors
.
toList
()))
.
then
(
mqttChannel
.
cancelRetry
(
id
))
.
then
(
mqttChannel
.
cancelRetry
(
MqttMessageType
.
PUBREC
,
id
))
.
then
(
mqttChannel
.
write
(
MqttMessageBuilder
.
buildPublishComp
(
id
),
false
));
}).
orElse
(
Mono
.
empty
());
case
PUBCOMP:
MqttMessageIdVariableHeader
messageIdVariableHeader1
=
(
MqttMessageIdVariableHeader
)
message
.
variableHeader
();
int
compId
=
messageIdVariableHeader1
.
messageId
();
return
mqttChannel
.
cancelRetry
(
compId
);
return
mqttChannel
.
cancelRetry
(
MqttMessageType
.
PUBREL
,
compId
);
case
PINGRESP:
default
:
return
Mono
.
empty
();
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/ConnectAckProtocol.java
浏览文件 @
3ac93bcc
...
...
@@ -27,7 +27,7 @@ public class ConnectAckProtocol implements Protocol<MqttConnAckMessage> {
@Override
public
Mono
<
Void
>
parseProtocol
(
MqttConnAckMessage
message
,
MqttChannel
mqttChannel
,
ContextView
contextView
)
{
return
mqttChannel
.
cancelRetry
(-
1
);
return
mqttChannel
.
cancelRetry
(
MqttMessageType
.
CONNECT
,
-
1
);
}
@Override
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/ConnectProtocol.java
浏览文件 @
3ac93bcc
package
com.github.quickmsg.core.protocol
;
import
com.github.quickmsg.core.mqtt.MqttReceiveContext
;
import
com.github.quickmsg.common.auth.PasswordAuthentication
;
import
com.github.quickmsg.common.channel.ChannelRegistry
;
import
com.github.quickmsg.common.channel.MqttChannel
;
...
...
@@ -10,6 +9,7 @@ import com.github.quickmsg.common.message.MessageRegistry;
import
com.github.quickmsg.common.message.MqttMessageBuilder
;
import
com.github.quickmsg.common.protocol.Protocol
;
import
com.github.quickmsg.common.topic.TopicRegistry
;
import
com.github.quickmsg.core.mqtt.MqttReceiveContext
;
import
io.netty.buffer.Unpooled
;
import
io.netty.handler.codec.mqtt.*
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -20,6 +20,7 @@ import reactor.util.context.ContextView;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Set
;
/**
* @author luxurong
...
...
@@ -131,7 +132,7 @@ public class ConnectProtocol implements Protocol<MqttConnectMessage> {
ChannelRegistry
channelRegistry
,
TopicRegistry
topicRegistry
,
MessageRegistry
messageRegistry
)
{
Lis
t
<
String
>
topics
=
sessionChannel
.
getTopics
();
Se
t
<
String
>
topics
=
sessionChannel
.
getTopics
();
mqttChannel
.
setTopics
(
topics
);
topicRegistry
.
clear
(
sessionChannel
);
topics
.
forEach
(
topic
->
topicRegistry
.
registryTopicConnection
(
topic
,
mqttChannel
));
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/PublishAckProtocol.java
浏览文件 @
3ac93bcc
...
...
@@ -30,7 +30,7 @@ public class PublishAckProtocol implements Protocol<MqttPubAckMessage> {
public
Mono
<
Void
>
parseProtocol
(
MqttPubAckMessage
message
,
MqttChannel
mqttChannel
,
ContextView
contextView
)
{
MqttMessageIdVariableHeader
idVariableHeader
=
message
.
variableHeader
();
int
messageId
=
idVariableHeader
.
messageId
();
return
mqttChannel
.
cancelRetry
(
messageId
);
return
mqttChannel
.
cancelRetry
(
MqttMessageType
.
PUBLISH
,
messageId
);
}
@Override
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/PublishProtocol.java
浏览文件 @
3ac93bcc
...
...
@@ -84,7 +84,6 @@ public class PublishProtocol implements Protocol<MqttPublishMessage> {
* @param other 其他操作
* @return Mono
*/
// todo 实时写入的可以使用duplicate 避免使用copy
private
Mono
<
Void
>
send
(
Set
<
MqttChannel
>
mqttChannels
,
MqttPublishMessage
message
,
MessageRegistry
messageRegistry
,
Mono
<
Void
>
other
)
{
return
Mono
.
when
(
mqttChannels
.
stream
()
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/SubscribeAckProtocol.java
浏览文件 @
3ac93bcc
...
...
@@ -26,7 +26,7 @@ public class SubscribeAckProtocol implements Protocol<MqttSubAckMessage> {
@Override
public
Mono
<
Void
>
parseProtocol
(
MqttSubAckMessage
message
,
MqttChannel
mqttChannel
,
ContextView
contextView
)
{
return
mqttChannel
.
cancelRetry
(
message
.
variableHeader
().
messageId
());
return
mqttChannel
.
cancelRetry
(
MqttMessageType
.
SUBSCRIBE
,
message
.
variableHeader
().
messageId
());
}
@Override
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/UnSubscribeAckProtocol.java
浏览文件 @
3ac93bcc
...
...
@@ -25,7 +25,7 @@ public class UnSubscribeAckProtocol implements Protocol<MqttUnsubAckMessage> {
@Override
public
Mono
<
Void
>
parseProtocol
(
MqttUnsubAckMessage
message
,
MqttChannel
mqttChannel
,
ContextView
contextView
)
{
return
mqttChannel
.
cancelRetry
(
message
.
variableHeader
().
messageId
());
return
mqttChannel
.
cancelRetry
(
MqttMessageType
.
UNSUBSCRIBE
,
message
.
variableHeader
().
messageId
());
}
@Override
...
...
smqtt-core/src/main/java/com/github/quickmsg/core/protocol/UnSubscribeProtocol.java
浏览文件 @
3ac93bcc
...
...
@@ -11,7 +11,9 @@ import reactor.core.publisher.Mono;
import
reactor.util.context.ContextView
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author luxurong
...
...
@@ -32,7 +34,7 @@ public class UnSubscribeProtocol implements Protocol<MqttUnsubscribeMessage> {
return
Mono
.
fromRunnable
(()
->
{
ReceiveContext
<?>
receiveContext
=
contextView
.
get
(
ReceiveContext
.
class
);
TopicRegistry
topicRegistry
=
receiveContext
.
getTopicRegistry
();
topicRegistry
.
clear
(
message
.
payload
().
topics
(
),
mqttChannel
);
topicRegistry
.
clear
(
new
HashSet
<>(
message
.
payload
().
topics
()
),
mqttChannel
);
}).
then
(
mqttChannel
.
write
(
MqttMessageBuilder
.
buildUnsubAck
(
message
.
variableHeader
().
messageId
()),
false
));
}
...
...
smqtt-core/src/main/resources/META-INF/services/com.github.
com.github.quickmsg.smqtt
.common.http.HttpActor
→
smqtt-core/src/main/resources/META-INF/services/com.github.
quickmsg
.common.http.HttpActor
浏览文件 @
3ac93bcc
文件已移动
smqtt-core/src/main/resources/META-INF/services/com.github.
com.github.quickmsg.smqtt
.common.interceptor.Interceptor
→
smqtt-core/src/main/resources/META-INF/services/com.github.
quickmsg
.common.interceptor.Interceptor
浏览文件 @
3ac93bcc
文件已移动
smqtt-core/src/main/resources/META-INF/services/com.github.
com.github.quickmsg.smqtt
.common.protocol.Protocol
→
smqtt-core/src/main/resources/META-INF/services/com.github.
quickmsg
.common.protocol.Protocol
浏览文件 @
3ac93bcc
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录