Commit d783890b7c21534e28ba3050adf633acaffd12df
1 parent
18c27196
review:【IoT 物联网】为 EMQX 协议添加 共享 的 Vertx
Showing
2 changed files
with
4 additions
and
1 deletions
yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/emqx/IotEmqxUpstreamProtocol.java
| @@ -31,7 +31,7 @@ public class IotEmqxUpstreamProtocol { | @@ -31,7 +31,7 @@ public class IotEmqxUpstreamProtocol { | ||
| 31 | 31 | ||
| 32 | private volatile boolean isRunning = false; | 32 | private volatile boolean isRunning = false; |
| 33 | 33 | ||
| 34 | - private Vertx vertx; | 34 | + private final Vertx vertx; |
| 35 | 35 | ||
| 36 | @Getter | 36 | @Getter |
| 37 | private final String serverId; | 37 | private final String serverId; |
yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/emqx/router/IotEmqxDownstreamHandler.java
| @@ -79,6 +79,7 @@ public class IotEmqxDownstreamHandler { | @@ -79,6 +79,7 @@ public class IotEmqxDownstreamHandler { | ||
| 79 | // 2. 根据消息方法和回复状态,构建 topic | 79 | // 2. 根据消息方法和回复状态,构建 topic |
| 80 | boolean isReply = IotDeviceMessageUtils.isReplyMessage(message); | 80 | boolean isReply = IotDeviceMessageUtils.isReplyMessage(message); |
| 81 | 81 | ||
| 82 | + // TODO @芋艿:看看基于 message 的 method 去反向推导; | ||
| 82 | // 3. 根据消息方法类型构建对应的主题 | 83 | // 3. 根据消息方法类型构建对应的主题 |
| 83 | switch (methodEnum) { | 84 | switch (methodEnum) { |
| 84 | case PROPERTY_POST: | 85 | case PROPERTY_POST: |
| @@ -96,6 +97,7 @@ public class IotEmqxDownstreamHandler { | @@ -96,6 +97,7 @@ public class IotEmqxDownstreamHandler { | ||
| 96 | break; | 97 | break; |
| 97 | 98 | ||
| 98 | case EVENT_POST: | 99 | case EVENT_POST: |
| 100 | + // TODO @haohao:不用 eventIdentifier 拼接哈,直接 data 里面,有 identifier 字段 | ||
| 99 | // 事件上报:只支持回复消息(下行) | 101 | // 事件上报:只支持回复消息(下行) |
| 100 | if (isReply) { | 102 | if (isReply) { |
| 101 | String identifier = IotDeviceMessageUtils.getIdentifier(message); | 103 | String identifier = IotDeviceMessageUtils.getIdentifier(message); |
| @@ -107,6 +109,7 @@ public class IotEmqxDownstreamHandler { | @@ -107,6 +109,7 @@ public class IotEmqxDownstreamHandler { | ||
| 107 | 109 | ||
| 108 | case SERVICE_INVOKE: | 110 | case SERVICE_INVOKE: |
| 109 | // 服务调用:支持请求和回复 | 111 | // 服务调用:支持请求和回复 |
| 112 | + // TODO @haohao:不用 serviceIdentifier 拼接哈,直接 data 里面,有 identifier 字段 | ||
| 110 | String serviceIdentifier = IotDeviceMessageUtils.getIdentifier(message); | 113 | String serviceIdentifier = IotDeviceMessageUtils.getIdentifier(message); |
| 111 | if (StrUtil.isNotBlank(serviceIdentifier)) { | 114 | if (StrUtil.isNotBlank(serviceIdentifier)) { |
| 112 | if (isReply) { | 115 | if (isReply) { |