ソースを参照

新增rocketMq支持、性能优化

xiwa 2 年 前
コミット
ec00cb92b9
86 ファイル変更719 行追加233 行削除
  1. BIN
      data/components/3ababc5e-15e9-45a7-8f38-2a6afd45c780/iot-http-biz-component-0.4.2-SNAPSHOT.jar
  2. BIN
      data/components/6c095554-35e7-4e9d-a8d2-bb919e9479f4/iot-emqx-component-0.4.2-SNAPSHOT.jar
  3. BIN
      data/components/eabb131d-8fd1-43a8-88d9-a198abfd3d42/iot-mqtt-component-0.4.2-SNAPSHOT.jar
  4. BIN
      data/components/fee0e826-963f-4e53-a2cf-11e3e5f784ea/iot-http-biz-component-0.4.2-SNAPSHOT.jar
  5. 3 3
      data/init/protocolComponent.json
  6. 1 1
      iot-auth-server/pom.xml
  7. 1 1
      iot-common/pom.xml
  8. 1 1
      iot-components/iot-component-base/pom.xml
  9. 5 1
      iot-components/iot-component-base/src/main/java/cc/iotkit/comp/IMessageHandler.java
  10. 1 1
      iot-components/iot-component-converter/pom.xml
  11. 2 2
      iot-components/iot-component-server/pom.xml
  12. 74 54
      iot-components/iot-component-server/src/main/java/cc/iotkit/comps/DeviceMessageHandler.java
  13. 16 0
      iot-components/iot-component-server/src/main/java/cc/iotkit/comps/MessageInfo.java
  14. 0 17
      iot-components/iot-component-server/src/main/java/cc/iotkit/comps/config/ComponentConfig.java
  15. 1 1
      iot-components/iot-ctwing-component/pom.xml
  16. 5 5
      iot-components/iot-emqx-component/dependency-reduced-pom.xml
  17. 1 1
      iot-components/iot-emqx-component/pom.xml
  18. 2 2
      iot-components/iot-http-biz-component/dependency-reduced-pom.xml
  19. 1 1
      iot-components/iot-http-biz-component/pom.xml
  20. 4 4
      iot-components/iot-mqtt-component/dependency-reduced-pom.xml
  21. 1 1
      iot-components/iot-mqtt-component/pom.xml
  22. 13 9
      iot-components/iot-mqtt-component/src/main/java/cc/iotkit/comp/mqtt/MqttVerticle.java
  23. 1 1
      iot-components/pom.xml
  24. 1 1
      iot-data/iot-data-cache/pom.xml
  25. 1 1
      iot-data/iot-data-service/pom.xml
  26. 1 1
      iot-data/iot-es-temporal-service/pom.xml
  27. 9 0
      iot-data/iot-es-temporal-service/src/main/java/cc/iotkit/temporal/es/document/DocVirtualDeviceLog.java
  28. 1 1
      iot-data/iot-es-temporal-service/src/main/java/cc/iotkit/temporal/es/service/DbStructureDataImpl.java
  29. 2 2
      iot-data/iot-model/pom.xml
  30. 2 2
      iot-data/iot-rdb-data-service/pom.xml
  31. 7 1
      iot-data/iot-rdb-data-service/src/main/java/cc/iotkit/data/model/ThingModelMapper.java
  32. 9 0
      iot-data/iot-rdb-data-service/src/main/java/cc/iotkit/data/service/UserInfoDataImpl.java
  33. 9 0
      iot-data/iot-rdb-data-service/src/main/java/cc/iotkit/data/service/VirtualDeviceDataImpl.java
  34. 1 1
      iot-data/iot-td-temporal-service/pom.xml
  35. 3 1
      iot-data/iot-td-temporal-service/readme.md
  36. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/config/Constants.java
  37. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/config/TdDatasourceConfig.java
  38. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dao/TdTemplate.java
  39. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/FieldParser.java
  40. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/TableManager.java
  41. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/TdField.java
  42. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/TdResponse.java
  43. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/TdRestApi.java
  44. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbDeviceProperty.java
  45. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbRuleLog.java
  46. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbTaskLog.java
  47. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbThingModelMessage.java
  48. 9 0
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbVirtualDeviceLog.java
  49. 62 46
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/service/DbStructureDataImpl.java
  50. 8 11
      iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/service/ThingModelMessageDataImpl.java
  51. 1 1
      iot-data/iot-temporal-service/pom.xml
  52. 2 2
      iot-data/iot-temporal-service/src/main/java/cc/iotkit/temporal/IDbStructureData.java
  53. 2 1
      iot-data/pom.xml
  54. 15 0
      iot-message-bus/iot-message-core/pom.xml
  55. 0 0
      iot-message-bus/iot-message-core/src/main/java/cc/iotkit/mq/ConsumerHandler.java
  56. 0 0
      iot-message-bus/iot-message-core/src/main/java/cc/iotkit/mq/MqConsumer.java
  57. 0 0
      iot-message-bus/iot-message-core/src/main/java/cc/iotkit/mq/MqProducer.java
  58. 39 0
      iot-message-bus/iot-message-rocketmq/pom.xml
  59. 11 0
      iot-message-bus/iot-message-rocketmq/readme.md
  60. 47 0
      iot-message-bus/iot-message-rocketmq/src/main/java/cc/iotkit/rocketmq/RocketMqConsumer.java
  61. 35 0
      iot-message-bus/iot-message-rocketmq/src/main/java/cc/iotkit/rocketmq/RocketMqProducer.java
  62. 35 0
      iot-message-bus/iot-message-rocketmq/src/main/java/cc/iotkit/rocketmq/config/RocketMqConfig.java
  63. 33 0
      iot-message-bus/iot-vertx-event-bus/pom.xml
  64. 10 1
      iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/BeanCodec.java
  65. 1 1
      iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/VertxManager.java
  66. 1 2
      iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/VertxMqConsumer.java
  67. 1 1
      iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/VertxMqProducer.java
  68. 27 0
      iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/config/VertxConfig.java
  69. 2 2
      iot-message-bus/iot-vertx-event-bus/src/test/java/test/MsgPubConsumeTest.java
  70. 8 1
      iot-message-bus/pom.xml
  71. 1 1
      iot-package/pom.xml
  72. 2 2
      iot-rule-engine/pom.xml
  73. 0 11
      iot-rule-engine/src/main/java/cc/iotkit/ruleengine/config/RuleConfiguration.java
  74. 9 0
      iot-rule-engine/src/main/java/cc/iotkit/ruleengine/expression/NeqComparator.java
  75. BIN
      iot-standalone/.DS_Store
  76. 20 8
      iot-standalone/pom.xml
  77. 1 1
      iot-standalone/src/main/java/cc/iotkit/manager/controller/ProductController.java
  78. 19 13
      iot-standalone/src/main/resources/application-dev.yml
  79. 6 0
      iot-standalone/src/main/resources/application-mysql.yml
  80. 6 0
      iot-standalone/src/main/resources/application.yml
  81. BIN
      iot-test-tool/iot-test-mqtt/.DS_Store
  82. 2 2
      iot-test-tool/iot-test-mqtt/pom.xml
  83. 1 4
      iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/performance/ReportTest.java
  84. 1 1
      iot-test-tool/pom.xml
  85. 1 1
      iot-virtual-device/pom.xml
  86. 14 3
      pom.xml

BIN
data/components/3ababc5e-15e9-45a7-8f38-2a6afd45c780/iot-http-biz-component-0.4.0-SNAPSHOT.jar → data/components/3ababc5e-15e9-45a7-8f38-2a6afd45c780/iot-http-biz-component-0.4.2-SNAPSHOT.jar


BIN
data/components/6c095554-35e7-4e9d-a8d2-bb919e9479f4/iot-emqx-component-0.4.0-SNAPSHOT.jar → data/components/6c095554-35e7-4e9d-a8d2-bb919e9479f4/iot-emqx-component-0.4.2-SNAPSHOT.jar


BIN
data/components/eabb131d-8fd1-43a8-88d9-a198abfd3d42/iot-mqtt-component-0.4.0-SNAPSHOT.jar → data/components/eabb131d-8fd1-43a8-88d9-a198abfd3d42/iot-mqtt-component-0.4.2-SNAPSHOT.jar


BIN
data/components/fee0e826-963f-4e53-a2cf-11e3e5f784ea/iot-http-biz-component-0.3.2-SNAPSHOT.jar → data/components/fee0e826-963f-4e53-a2cf-11e3e5f784ea/iot-http-biz-component-0.4.2-SNAPSHOT.jar


+ 3 - 3
data/init/protocolComponent.json

@@ -5,7 +5,7 @@
     "name": "MQTT标准协议组件",
     "type": "device",
     "protocol": "mqtt",
-    "jarFile": "iot-mqtt-component-0.4.0-SNAPSHOT.jar",
+    "jarFile": "iot-mqtt-component-0.4.2-SNAPSHOT.jar",
     "config": "{\"port\":1883,\"ssl\":false,\"type\":\"server\"}",
     "converter": "6260396d67aced2696184053",
     "state": "running",
@@ -17,7 +17,7 @@
     "name": "EMQX标准协议组件",
     "type": "device",
     "protocol": "mqtt",
-    "jarFile": "iot-emqx-component-0.4.0-SNAPSHOT.jar",
+    "jarFile": "iot-emqx-component-0.4.2-SNAPSHOT.jar",
     "config": "{\"port\":\"1884\",\"ssl\":false,\"type\":\"client\",\"subscribeTopics\":[\"/sys/+/+/s/#\",\"/sys/client/connected\",\"/sys/client/disconnected\",\"/sys/session/subscribed\",\"/sys/session/unsubscribed\"],\"authPort\":\"8088\",\"broker\":\"127.0.0.1\",\"clientId\":\"test\",\"username\":\"test\",\"password\":\"123\"}",
     "converter": "6260396d67aced2696184053",
     "state": "stopped",
@@ -29,7 +29,7 @@
     "name": "小度音箱接入组件",
     "type": "biz",
     "protocol": "http",
-    "jarFile": "iot-http-biz-component-0.4.0-SNAPSHOT.jar",
+    "jarFile": "iot-http-biz-component-0.4.2-SNAPSHOT.jar",
     "config": "{\"port\":\"8084\"}",
     "converter": "",
     "state": "stopped",

+ 1 - 1
iot-auth-server/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
iot-common/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
iot-components/iot-component-base/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-components</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 5 - 1
iot-components/iot-component-base/src/main/java/cc/iotkit/comp/IMessageHandler.java

@@ -12,10 +12,14 @@ package cc.iotkit.comp;
 import cc.iotkit.comp.model.ReceiveResult;
 
 import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.function.Consumer;
 
 public interface IMessageHandler {
 
-    ReceiveResult onReceive(Map<String, Object> head, String type, String msg);
+    void onReceive(Map<String, Object> head, String type, String msg);
+
+    void onReceive(Map<String, Object> head, String type, String msg, Consumer<ReceiveResult> onResult);
 
     /**
      * 添加脚本环境变量

+ 1 - 1
iot-components/iot-component-converter/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-components</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 2 - 2
iot-components/iot-component-server/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-components</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -84,7 +84,7 @@
 
         <dependency>
             <groupId>cc.iotkit</groupId>
-            <artifactId>iot-message-bus</artifactId>
+            <artifactId>iot-message-core</artifactId>
         </dependency>
 
         <dependency>

+ 74 - 54
iot-components/iot-component-server/src/main/java/cc/iotkit/comps/DeviceMessageHandler.java

@@ -32,6 +32,8 @@ import org.apache.commons.beanutils.BeanUtils;
 import javax.script.ScriptEngineManager;
 import javax.script.ScriptException;
 import java.util.Map;
+import java.util.concurrent.*;
+import java.util.function.Consumer;
 
 @Slf4j
 @Data
@@ -50,6 +52,10 @@ public class DeviceMessageHandler implements IMessageHandler {
 
     private final DeviceRouter deviceRouter;
 
+    private final ExecutorService executorService = new ThreadPoolExecutor(0, Integer.MAX_VALUE,
+            60L, TimeUnit.SECONDS,
+            new LinkedBlockingQueue<>());
+
     @SneakyThrows
     public DeviceMessageHandler(DeviceComponentManager deviceComponentManager,
                                 IDeviceComponent component,
@@ -67,64 +73,78 @@ public class DeviceMessageHandler implements IMessageHandler {
         scriptObj = engine.eval(String.format("new (function () {\n%s})()", script));
     }
 
-    public ReceiveResult onReceive(Map<String, Object> head, String type, String msg) {
-        try {
-            ScriptObjectMirror result = (ScriptObjectMirror) invokeMethod("onReceive", head, type, msg);
-            log.info("onReceive script result:{}", JsonUtil.toJsonString(result));
-            Object rstType = result.get("type");
-            if (rstType == null) {
-                return null;
-            }
-            //取脚本执行后返回的数据
-            Object data = JsonUtil.toObject((ScriptObjectMirror) result.get("data"));
-            if (!(data instanceof Map)) {
-                throw new BizException("script result data is incorrect");
-            }
-
-            Map<String, Object> dataMap = (Map) data;
-            //获取动作数据
-            Action action = getAction(result.get("action"));
+    public void onReceive(Map<String, Object> head, String type, String msg) {
+        onReceive(head, type, msg, (r) -> {
+        });
+    }
 
-            if ("register".equals(rstType)) {
-                //注册数据
-                RegisterInfo regInfo = RegisterInfo.from(dataMap);
-                if (regInfo == null) {
-                    return null;
+    public void onReceive(Map<String, Object> head, String type, String msg, Consumer<ReceiveResult> onResult) {
+        executorService.submit(() -> {
+            try {
+                ScriptObjectMirror result = (ScriptObjectMirror) invokeMethod("onReceive", head, type, msg);
+                log.info("onReceive script result:{}", JsonUtil.toJsonString(result));
+                Object rstType = result.get("type");
+                if (rstType == null) {
+                    onResult.accept(null);
+                    return;
                 }
-                doRegister(regInfo);
-                doAction(action);
-                return new ReceiveResult(regInfo.getProductKey(), regInfo.getDeviceName(), regInfo);
-            } else if ("auth".equals(rstType)) {
-                //设备认证
-                AuthInfo authInfo = new AuthInfo();
-                BeanUtils.populate(authInfo, dataMap);
-                doAuth(authInfo);
-                doAction(action);
-                return new ReceiveResult(authInfo.getProductKey(), authInfo.getDeviceName(), authInfo);
-            } else if ("state".equals(rstType)) {
-                //设备状态变更
-                DeviceState state = DeviceState.from(dataMap);
-                if (state == null) {
-                    return null;
+                //取脚本执行后返回的数据
+                Object data = JsonUtil.toObject((ScriptObjectMirror) result.get("data"));
+                if (!(data instanceof Map)) {
+                    throw new BizException("script result data is incorrect");
                 }
-                doStateChange(state);
-                doAction(action);
-                return new ReceiveResult(state.getProductKey(), state.getDeviceName(), state);
-            } else if ("report".equals(rstType)) {
-                //上报数据
-                DeviceMessage message = new DeviceMessage();
-                BeanUtils.populate(message, dataMap);
-                doReport(message);
-                doAction(action);
-                return new ReceiveResult(message.getProductKey(), message.getDeviceName(), message);
-            }
 
-        } catch (BizException e) {
-            throw e;
-        } catch (Throwable e) {
-            throw new BizException("receive component message error", e);
-        }
-        return null;
+                Map<String, Object> dataMap = (Map) data;
+                //获取动作数据
+                Action action = getAction(result.get("action"));
+
+                if ("register".equals(rstType)) {
+                    //注册数据
+                    RegisterInfo regInfo = RegisterInfo.from(dataMap);
+                    if (regInfo == null) {
+                        onResult.accept(null);
+                        return;
+                    }
+                    doRegister(regInfo);
+                    doAction(action);
+                    onResult.accept(new ReceiveResult(regInfo.getProductKey(), regInfo.getDeviceName(), regInfo));
+                    return;
+                } else if ("auth".equals(rstType)) {
+                    //设备认证
+                    AuthInfo authInfo = new AuthInfo();
+                    BeanUtils.populate(authInfo, dataMap);
+                    doAuth(authInfo);
+                    doAction(action);
+                    onResult.accept(new ReceiveResult(authInfo.getProductKey(), authInfo.getDeviceName(), authInfo));
+                    return;
+                } else if ("state".equals(rstType)) {
+                    //设备状态变更
+                    DeviceState state = DeviceState.from(dataMap);
+                    if (state == null) {
+                        onResult.accept(null);
+                        return;
+                    }
+                    doStateChange(state);
+                    doAction(action);
+                    onResult.accept(new ReceiveResult(state.getProductKey(), state.getDeviceName(), state));
+                    return;
+                } else if ("report".equals(rstType)) {
+                    //上报数据
+                    DeviceMessage message = new DeviceMessage();
+                    BeanUtils.populate(message, dataMap);
+                    doReport(message);
+                    doAction(action);
+                    onResult.accept(new ReceiveResult(message.getProductKey(), message.getDeviceName(), message));
+                    return;
+                }
+
+            } catch (BizException e) {
+                throw e;
+            } catch (Throwable e) {
+                throw new BizException("receive component message error", e);
+            }
+            onResult.accept(null);
+        });
     }
 
     private void doRegister(RegisterInfo reg) throws ScriptException, NoSuchMethodException {

+ 16 - 0
iot-components/iot-component-server/src/main/java/cc/iotkit/comps/MessageInfo.java

@@ -0,0 +1,16 @@
+package cc.iotkit.comps;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class MessageInfo {
+    private Map<String, Object> head;
+    private String type;
+    private String msg;
+}

+ 0 - 17
iot-components/iot-component-server/src/main/java/cc/iotkit/comps/config/ComponentConfig.java

@@ -1,15 +1,9 @@
 package cc.iotkit.comps.config;
 
-import cc.iotkit.model.device.message.ThingModelMessage;
-import cc.iotkit.mq.MqConsumer;
-import cc.iotkit.mq.MqProducer;
-import cc.iotkit.mq.vertx.VertxMqConsumer;
-import cc.iotkit.mq.vertx.VertxMqProducer;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 import lombok.Data;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -41,16 +35,5 @@ public class ComponentConfig {
         return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
     }
 
-    @ConditionalOnMissingBean
-    @Bean
-    public MqProducer<ThingModelMessage> getThingModelMessageProducer() {
-        return new VertxMqProducer<>(ThingModelMessage.class);
-    }
-
-    @ConditionalOnMissingBean
-    @Bean
-    public MqConsumer<ThingModelMessage> getThingModelMessageConsumer() {
-        return new VertxMqConsumer<>(ThingModelMessage.class);
-    }
 
 }

+ 1 - 1
iot-components/iot-ctwing-component/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-components</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 5 - 5
iot-components/iot-emqx-component/dependency-reduced-pom.xml

@@ -3,7 +3,7 @@
   <parent>
     <artifactId>iot-components</artifactId>
     <groupId>cc.iotkit</groupId>
-    <version>0.4.1-SNAPSHOT</version>
+    <version>0.4.2-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>iot-emqx-component</artifactId>
@@ -84,25 +84,25 @@
     <dependency>
       <groupId>cc.iotkit</groupId>
       <artifactId>iot-model</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.4.2-SNAPSHOT</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>cc.iotkit</groupId>
       <artifactId>iot-common</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.4.2-SNAPSHOT</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>cc.iotkit</groupId>
       <artifactId>iot-component-base</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.4.2-SNAPSHOT</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>cc.iotkit</groupId>
       <artifactId>iot-data-service</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.4.2-SNAPSHOT</version>
       <scope>compile</scope>
     </dependency>
   </dependencies>

+ 1 - 1
iot-components/iot-emqx-component/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-components</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 2 - 2
iot-components/iot-http-biz-component/dependency-reduced-pom.xml

@@ -3,7 +3,7 @@
   <parent>
     <artifactId>iot-components</artifactId>
     <groupId>cc.iotkit</groupId>
-    <version>0.4.1-SNAPSHOT</version>
+    <version>0.4.2-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>iot-http-biz-component</artifactId>
@@ -58,7 +58,7 @@
     <dependency>
       <groupId>cc.iotkit</groupId>
       <artifactId>iot-component-base</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.4.2-SNAPSHOT</version>
       <scope>compile</scope>
     </dependency>
   </dependencies>

+ 1 - 1
iot-components/iot-http-biz-component/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-components</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 4 - 4
iot-components/iot-mqtt-component/dependency-reduced-pom.xml

@@ -3,7 +3,7 @@
   <parent>
     <artifactId>iot-components</artifactId>
     <groupId>cc.iotkit</groupId>
-    <version>0.4.1-SNAPSHOT</version>
+    <version>0.4.2-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>iot-mqtt-component</artifactId>
@@ -82,19 +82,19 @@
     <dependency>
       <groupId>cc.iotkit</groupId>
       <artifactId>iot-common</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.4.2-SNAPSHOT</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>cc.iotkit</groupId>
       <artifactId>iot-component-base</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.4.2-SNAPSHOT</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>cc.iotkit</groupId>
       <artifactId>iot-data-service</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.4.2-SNAPSHOT</version>
       <scope>compile</scope>
     </dependency>
   </dependencies>

+ 1 - 1
iot-components/iot-mqtt-component/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-components</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 13 - 9
iot-components/iot-mqtt-component/src/main/java/cc/iotkit/comp/mqtt/MqttVerticle.java

@@ -76,9 +76,11 @@ public class MqttVerticle extends AbstractVerticle {
             log.info("MQTT client auth,clientId:{},username:{},password:{}",
                     clientId, auth.getUsername(), auth.getPassword());
             try {
-                ReceiveResult result = executor.onReceive(new HashMap<>(), "auth", authJson);
-                //保存设备与连接关系
-                endpointMap.put(getEndpointKey(result), endpoint);
+                executor.onReceive(new HashMap<>(), "auth", authJson, (r) -> {
+                    //保存设备与连接关系
+                    endpointMap.put(getEndpointKey(r), endpoint);
+                });
+
             } catch (Throwable e) {
                 log.error("auth failed", e);
                 endpoint.reject(MqttConnectReturnCode.CONNECTION_REFUSED_NOT_AUTHORIZED);
@@ -90,14 +92,16 @@ public class MqttVerticle extends AbstractVerticle {
             endpoint.accept(false);
             endpoint.closeHandler((v) -> {
                 log.warn("client connection closed,clientId:{}", clientId);
-                ReceiveResult result = executor.onReceive(new HashMap<>(), "disconnect", clientId);
-                //删除设备与连接关系
-                endpointMap.remove(getEndpointKey(result));
+                executor.onReceive(new HashMap<>(), "disconnect", clientId, (r) -> {
+                    //删除设备与连接关系
+                    endpointMap.remove(getEndpointKey(r));
+                });
             }).disconnectMessageHandler(disconnectMessage -> {
                 log.info("Received disconnect from client, reason code = {}", disconnectMessage.code());
-                ReceiveResult result = executor.onReceive(new HashMap<>(), "disconnect", clientId);
-                //删除设备与连接关系
-                endpointMap.remove(getEndpointKey(result));
+                executor.onReceive(new HashMap<>(), "disconnect", clientId, (r) -> {
+                    //删除设备与连接关系
+                    endpointMap.remove(getEndpointKey(r));
+                });
             }).subscribeHandler(subscribe -> {
                 List<MqttSubAckReasonCode> reasonCodes = new ArrayList<>();
                 for (MqttTopicSubscription s : subscribe.topicSubscriptions()) {

+ 1 - 1
iot-components/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
iot-data/iot-data-cache/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-data</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
iot-data/iot-data-service/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-data</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
iot-data/iot-es-temporal-service/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-data</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 9 - 0
iot-data/iot-es-temporal-service/src/main/java/cc/iotkit/temporal/es/document/DocVirtualDeviceLog.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.es.document;
 
 import lombok.AllArgsConstructor;

+ 1 - 1
iot-data/iot-es-temporal-service/src/main/java/cc/iotkit/temporal/es/service/DbStructureDataImpl.java

@@ -12,7 +12,7 @@ public class DbStructureDataImpl implements IDbStructureData {
     }
 
     @Override
-    public void undefineThingModel(ThingModel thingModel) {
+    public void updateThingModel(ThingModel thingModel) {
 
     }
 

+ 2 - 2
iot-data/iot-model/pom.xml

@@ -5,9 +5,9 @@
     <parent>
         <artifactId>iot-data</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
-    <version>0.4.1-SNAPSHOT</version>
+    <version>0.4.2-SNAPSHOT</version>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>iot-model</artifactId>

+ 2 - 2
iot-data/iot-rdb-data-service/pom.xml

@@ -5,9 +5,9 @@
     <parent>
         <artifactId>iot-data</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
-    <version>0.4.1-SNAPSHOT</version>
+    <version>0.4.2-SNAPSHOT</version>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>iot-rdb-data-service</artifactId>

+ 7 - 1
iot-data/iot-rdb-data-service/src/main/java/cc/iotkit/data/model/ThingModelMapper.java

@@ -11,6 +11,7 @@ package cc.iotkit.data.model;
 
 import cc.iotkit.common.utils.JsonUtil;
 import cc.iotkit.model.product.ThingModel;
+import org.apache.commons.lang3.StringUtils;
 import org.mapstruct.Mapper;
 import org.mapstruct.Mapping;
 import org.mapstruct.factory.Mappers;
@@ -27,8 +28,13 @@ public interface ThingModelMapper {
     ThingModel toDto(TbThingModel vo);
 
     static ThingModel toDtoFix(TbThingModel vo) {
+        if (vo == null) {
+            return null;
+        }
         ThingModel dto = M.toDto(vo);
-        dto.setModel(JsonUtil.parse(vo.getModel(), ThingModel.Model.class));
+        if (StringUtils.isNotBlank(vo.getModel())) {
+            dto.setModel(JsonUtil.parse(vo.getModel(), ThingModel.Model.class));
+        }
         return dto;
     }
 

+ 9 - 0
iot-data/iot-rdb-data-service/src/main/java/cc/iotkit/data/service/UserInfoDataImpl.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.data.service;
 
 import cc.iotkit.data.IUserInfoData;

+ 9 - 0
iot-data/iot-rdb-data-service/src/main/java/cc/iotkit/data/service/VirtualDeviceDataImpl.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.data.service;
 
 import cc.iotkit.data.IVirtualDeviceData;

+ 1 - 1
iot-data/iot-td-temporal-service/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-data</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 3 - 1
iot-data/iot-td-temporal-service/readme.md

@@ -1,5 +1,7 @@
 ### 时序数据库服务接口的TDengine实现
 
-版本:v0.4.1
+支持版本:v0.4.1
+
+TDengine版本:2.6.0.12
 
 

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/config/Constants.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.config;
 
 public interface Constants {

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/config/TdDatasourceConfig.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.config;
 
 import cc.iotkit.temporal.td.dao.TdTemplate;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dao/TdTemplate.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.dao;
 
 import org.springframework.jdbc.core.JdbcTemplate;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/FieldParser.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.dm;
 
 import cc.iotkit.model.product.ThingModel;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/TableManager.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.dm;
 
 import java.util.List;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/TdField.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.dm;
 
 import lombok.AllArgsConstructor;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/TdResponse.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.dm;
 
 import lombok.AllArgsConstructor;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/dm/TdRestApi.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.dm;
 
 import cc.iotkit.common.utils.JsonUtil;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbDeviceProperty.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.model;
 
 import lombok.AllArgsConstructor;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbRuleLog.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.model;
 
 import lombok.AllArgsConstructor;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbTaskLog.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.model;
 
 import lombok.AllArgsConstructor;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbThingModelMessage.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.model;
 
 import lombok.AllArgsConstructor;

+ 9 - 0
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/model/TbVirtualDeviceLog.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.model;
 
 import lombok.AllArgsConstructor;

+ 62 - 46
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/service/DbStructureDataImpl.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.temporal.td.service;
 
 import cc.iotkit.common.utils.JsonUtil;
@@ -50,58 +59,65 @@ public class DbStructureDataImpl implements IDbStructureData {
      * 根据物模型更新超级表结构
      */
     @Override
-    public void undefineThingModel(ThingModel thingModel) {
-        //获取旧字段信息
-        String tbName = Constants.getProductPropertySTableName(thingModel.getProductKey());
-        String sql = TableManager.getDescTableSql(tbName);
-        TdResponse response = tdRestApi.execSql(sql);
-        if (response.getCode() != TdResponse.CODE_SUCCESS) {
-            throw new RuntimeException("get des table error:" + JsonUtil.toJsonString(response));
-        }
-
-        List<TdField> oldFields = FieldParser.parse(response.getData());
-        List<TdField> newFields = FieldParser.parse(thingModel);
-        //对比差异
-
-        //找出新增的字段
-        List<TdField> addFields = newFields.stream().filter((f) -> oldFields.stream()
-                .noneMatch(old -> old.getName().equals(f.getName())))
-                .collect(Collectors.toList());
-        if (addFields.size() > 0) {
-            sql = TableManager.getAddSTableColumnSql(tbName, addFields);
-            response = tdRestApi.execSql(sql);
+    public void updateThingModel(ThingModel thingModel) {
+        try {
+            //获取旧字段信息
+            String tbName = Constants.getProductPropertySTableName(thingModel.getProductKey());
+            String sql = TableManager.getDescTableSql(tbName);
+            TdResponse response = tdRestApi.execSql(sql);
             if (response.getCode() != TdResponse.CODE_SUCCESS) {
-                throw new RuntimeException("add table column error:" + JsonUtil.toJsonString(response));
+                throw new RuntimeException("get des table error:" + JsonUtil.toJsonString(response));
             }
-        }
 
-        //找出修改的字段
-        List<TdField> modifyFields = newFields.stream().filter((f) -> oldFields.stream()
-                .anyMatch(old ->
-                        old.getName().equals(f.getName()) //字段名相同
-                                //字段类型或长度不同
-                                && (old.getType().equals(f.getType()) || old.getLength() != f.getLength())
-                ))
-                .collect(Collectors.toList());
-
-        if (modifyFields.size() > 0) {
-            sql = TableManager.getModifySTableColumnSql(tbName, modifyFields);
-            response = tdRestApi.execSql(sql);
-            if (response.getCode() != TdResponse.CODE_SUCCESS) {
-                throw new RuntimeException("modify table column error:" + JsonUtil.toJsonString(response));
+            List<TdField> oldFields = FieldParser.parse(response.getData());
+            List<TdField> newFields = FieldParser.parse(thingModel);
+            //对比差异
+
+            //找出新增的字段
+            List<TdField> addFields = newFields.stream().filter((f) -> oldFields.stream()
+                    .noneMatch(old -> old.getName().equals(f.getName())))
+                    .collect(Collectors.toList());
+            if (addFields.size() > 0) {
+                sql = TableManager.getAddSTableColumnSql(tbName, addFields);
+                response = tdRestApi.execSql(sql);
+                if (response.getCode() != TdResponse.CODE_SUCCESS) {
+                    throw new RuntimeException("add table column error:" + JsonUtil.toJsonString(response));
+                }
             }
-        }
 
-        //找出删除的字段
-        List<TdField> dropFields = oldFields.stream().filter((f) -> newFields.stream()
-                .noneMatch(old -> old.getName().equals(f.getName())))
-                .collect(Collectors.toList());
-        if (dropFields.size() > 0) {
-            sql = TableManager.getDropSTableColumnSql(tbName, dropFields);
-            response = tdRestApi.execSql(sql);
-            if (response.getCode() != TdResponse.CODE_SUCCESS) {
-                throw new RuntimeException("drop table column error:" + JsonUtil.toJsonString(response));
+            //找出修改的字段
+            List<TdField> modifyFields = newFields.stream().filter((f) -> oldFields.stream()
+                    .anyMatch(old ->
+                            old.getName().equals(f.getName()) //字段名相同
+                                    //字段类型或长度不同
+                                    && (!old.getType().equals(f.getType()) || old.getLength() != f.getLength())
+                    ))
+                    .collect(Collectors.toList());
+
+            if (modifyFields.size() > 0) {
+                sql = TableManager.getModifySTableColumnSql(tbName, modifyFields);
+                response = tdRestApi.execSql(sql);
+                if (response.getCode() != TdResponse.CODE_SUCCESS) {
+                    throw new RuntimeException("modify table column error:" + JsonUtil.toJsonString(response));
+                }
+            }
+
+            //找出删除的字段
+            List<TdField> dropFields = oldFields.stream().filter((f) ->
+                    !"time".equals(f.getName()) &&
+                            !"device_id".equals(f.getName()) && newFields.stream()
+                            //字段名不是time且没有相同字段名的
+                            .noneMatch(n -> n.getName().equals(f.getName())))
+                    .collect(Collectors.toList());
+            if (dropFields.size() > 0) {
+                sql = TableManager.getDropSTableColumnSql(tbName, dropFields);
+                response = tdRestApi.execSql(sql);
+                if (response.getCode() != TdResponse.CODE_SUCCESS) {
+                    throw new RuntimeException("drop table column error:" + JsonUtil.toJsonString(response));
+                }
             }
+        } catch (Throwable e) {
+            log.error("update thingmodel stable failed", e);
         }
     }
 

+ 8 - 11
iot-data/iot-td-temporal-service/src/main/java/cc/iotkit/temporal/td/service/ThingModelMessageDataImpl.java

@@ -36,32 +36,29 @@ public class ThingModelMessageDataImpl implements IThingModelMessageData {
                                                              String identifier,
                                                              int page, int size) {
         String sql = "select time,mid,product_key,device_name,type,identifier,code,data,report_time " +
-                "from thing_model_message_%s %s order by time desc limit %d offset %d";
+                "from thing_model_message where device_id=? %s order by time desc limit %d offset %d";
 
         //构建动态条件
         List<Object> args = new ArrayList<>();
-        List<String> cons = new ArrayList<>();
+        args.add(deviceId);
+        StringBuilder sbCond = new StringBuilder();
         if (StringUtils.isNotBlank(type)) {
-            cons.add("type=?");
+            sbCond.append(" and type=? ");
             args.add(type);
         }
         if (StringUtils.isNotBlank(identifier)) {
-            cons.add("identifier=?");
+            sbCond.append("and identifier=? ");
             args.add(identifier);
         }
-        String condition = "";
-        if (cons.size() > 0) {
-            condition = "where " + String.join(" and ", cons);
-        }
 
-        sql = String.format(sql, deviceId.toLowerCase(), condition, size, (page - 1) * size);
+        sql = String.format(sql, sbCond.toString(), size, (page - 1) * size);
         List<TbThingModelMessage> ruleLogs = tdTemplate.query(sql,
                 new BeanPropertyRowMapper<>(TbThingModelMessage.class),
                 args.toArray()
         );
 
-        sql = String.format("select count(*) from thing_model_message_%s %s",
-                deviceId.toLowerCase(), condition);
+        sql = String.format("select count(*) from thing_model_message where device_id=? %s",
+                sbCond.toString());
         List<Long> counts = tdTemplate.queryForList(sql, Long.class, args.toArray());
         long count = counts.size() > 0 ? counts.get(0) : 0;
 

+ 1 - 1
iot-data/iot-temporal-service/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-data</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 2 - 2
iot-data/iot-temporal-service/src/main/java/cc/iotkit/temporal/IDbStructureData.java

@@ -13,9 +13,9 @@ public interface IDbStructureData {
     void defineThingModel(ThingModel thingModel);
 
     /**
-     * 取消物模型定义
+     * 更新物模型定义
      */
-    void undefineThingModel(ThingModel thingModel);
+    void updateThingModel(ThingModel thingModel);
 
     /**
      * 初始化数据库结构

+ 2 - 1
iot-data/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>pom</packaging>
@@ -17,6 +17,7 @@
         <module>iot-temporal-service</module>
         <module>iot-es-temporal-service</module>
         <module>iot-rdb-data-service</module>
+        <module>iot-td-temporal-service</module>
     </modules>
 
     <artifactId>iot-data</artifactId>

+ 15 - 0
iot-message-bus/iot-message-core/pom.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>iot-message-bus</artifactId>
+        <groupId>cc.iotkit</groupId>
+        <version>0.4.2-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>iot-message-core</artifactId>
+
+
+</project>

+ 0 - 0
iot-message-bus/src/main/java/cc/iotkit/mq/ConsumerHandler.java → iot-message-bus/iot-message-core/src/main/java/cc/iotkit/mq/ConsumerHandler.java


+ 0 - 0
iot-message-bus/src/main/java/cc/iotkit/mq/MqConsumer.java → iot-message-bus/iot-message-core/src/main/java/cc/iotkit/mq/MqConsumer.java


+ 0 - 0
iot-message-bus/src/main/java/cc/iotkit/mq/MqProducer.java → iot-message-bus/iot-message-core/src/main/java/cc/iotkit/mq/MqProducer.java


+ 39 - 0
iot-message-bus/iot-message-rocketmq/pom.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>iot-message-bus</artifactId>
+        <groupId>cc.iotkit</groupId>
+        <version>0.4.2-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>iot-message-rocketmq</artifactId>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-autoconfigure</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>rocketmq-client</artifactId>
+            <version>4.9.4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>cc.iotkit</groupId>
+            <artifactId>iot-model</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cc.iotkit</groupId>
+            <artifactId>iot-message-core</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

+ 11 - 0
iot-message-bus/iot-message-rocketmq/readme.md

@@ -0,0 +1,11 @@
+### 支持rocketMq作为消息总线
+
+版本:0.4.2
+
+rocketMq版本:4.9.4
+
+####开启方式:
+
+1、application.yml中打开注释支持rocketMq作为消息总线
+
+2、pom.xml中打开注释使用rocketmq消息总线

+ 47 - 0
iot-message-bus/iot-message-rocketmq/src/main/java/cc/iotkit/rocketmq/RocketMqConsumer.java

@@ -0,0 +1,47 @@
+package cc.iotkit.rocketmq;
+
+import cc.iotkit.common.utils.JsonUtil;
+import cc.iotkit.mq.ConsumerHandler;
+import cc.iotkit.mq.MqConsumer;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
+import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.springframework.beans.factory.annotation.Value;
+
+import java.nio.charset.StandardCharsets;
+
+@Slf4j
+public class RocketMqConsumer<T> implements MqConsumer<T> {
+
+    private String nameServer;
+
+    private final Class<T> msgType;
+
+    public RocketMqConsumer(String nameServer, Class<T> cls) {
+        this.nameServer = nameServer;
+        this.msgType = cls;
+    }
+
+    @Override
+    public void consume(String topic, ConsumerHandler<T> handler) {
+        try {
+            DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(handler.getClass()
+                    .getName().replace(".", ""));
+            consumer.setNamesrvAddr(nameServer);
+            consumer.subscribe(topic, "*");
+            consumer.registerMessageListener((MessageListenerConcurrently) (messages, context) -> {
+                for (MessageExt message : messages) {
+                    T msg = JsonUtil.parse(new String(message.getBody(), StandardCharsets.UTF_8), msgType);
+                    handler.handler(msg);
+                }
+                return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+            });
+            consumer.start();
+        } catch (Throwable e) {
+            log.error("consume error", e);
+        }
+    }
+
+}

+ 35 - 0
iot-message-bus/iot-message-rocketmq/src/main/java/cc/iotkit/rocketmq/RocketMqProducer.java

@@ -0,0 +1,35 @@
+package cc.iotkit.rocketmq;
+
+import cc.iotkit.common.exception.BizException;
+import cc.iotkit.common.utils.JsonUtil;
+import cc.iotkit.mq.MqProducer;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.common.message.Message;
+
+import java.nio.charset.StandardCharsets;
+
+public class RocketMqProducer<T> implements MqProducer<T> {
+
+    private final DefaultMQProducer producer;
+
+    public RocketMqProducer(String nameServer, String group) {
+        try {
+            producer = new DefaultMQProducer(group);
+            producer.setNamesrvAddr(nameServer);
+            producer.start();
+        } catch (Throwable e) {
+            throw new BizException("init producer error", e);
+        }
+    }
+
+    @Override
+    public void publish(String topic, T msg) {
+        try {
+            producer.send(new Message(topic,
+                    JsonUtil.toJsonString(msg).getBytes(StandardCharsets.UTF_8)));
+        } catch (Throwable e) {
+            throw new BizException("publish msg error", e);
+        }
+    }
+
+}

+ 35 - 0
iot-message-bus/iot-message-rocketmq/src/main/java/cc/iotkit/rocketmq/config/RocketMqConfig.java

@@ -0,0 +1,35 @@
+package cc.iotkit.rocketmq.config;
+
+import cc.iotkit.model.device.message.ThingModelMessage;
+import cc.iotkit.mq.MqConsumer;
+import cc.iotkit.mq.MqProducer;
+import cc.iotkit.rocketmq.RocketMqConsumer;
+import cc.iotkit.rocketmq.RocketMqProducer;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class RocketMqConfig {
+
+    @Value("${rocketmq.name-server}")
+    private String nameServer;
+
+    @Value("${rocketmq.producer.group}")
+    private String group;
+
+    @ConditionalOnMissingBean
+    @Bean
+    public MqProducer<ThingModelMessage> getThingModelMessageProducer() {
+        return new RocketMqProducer<>(nameServer, group);
+    }
+
+    @ConditionalOnMissingBean
+    @Bean
+    public MqConsumer<ThingModelMessage> getThingModelMessageConsumer() {
+        return new RocketMqConsumer<>(nameServer, ThingModelMessage.class);
+    }
+
+
+}

+ 33 - 0
iot-message-bus/iot-vertx-event-bus/pom.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>iot-message-bus</artifactId>
+        <groupId>cc.iotkit</groupId>
+        <version>0.4.2-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>iot-vertx-event-bus</artifactId>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-autoconfigure</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cc.iotkit</groupId>
+            <artifactId>iot-message-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cc.iotkit</groupId>
+            <artifactId>iot-model</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

+ 10 - 1
iot-message-bus/src/main/java/cc/iotkit/mq/vertx/BeanCodec.java → iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/BeanCodec.java

@@ -1,4 +1,13 @@
-package cc.iotkit.mq.vertx;
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
+package cc.iotkit.vertx;
 
 import cc.iotkit.common.utils.JsonUtil;
 import io.vertx.core.buffer.Buffer;

+ 1 - 1
iot-message-bus/src/main/java/cc/iotkit/mq/vertx/VertxManager.java → iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/VertxManager.java

@@ -7,7 +7,7 @@
  * | Author: xw2sy@163.com
  * +----------------------------------------------------------------------
  */
-package cc.iotkit.mq.vertx;
+package cc.iotkit.vertx;
 
 import io.vertx.core.Vertx;
 

+ 1 - 2
iot-message-bus/src/main/java/cc/iotkit/mq/vertx/VertxMqConsumer.java → iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/VertxMqConsumer.java

@@ -7,9 +7,8 @@
  * | Author: xw2sy@163.com
  * +----------------------------------------------------------------------
  */
-package cc.iotkit.mq.vertx;
+package cc.iotkit.vertx;
 
-import cc.iotkit.common.utils.JsonUtil;
 import cc.iotkit.mq.ConsumerHandler;
 import cc.iotkit.mq.MqConsumer;
 import io.vertx.core.AbstractVerticle;

+ 1 - 1
iot-message-bus/src/main/java/cc/iotkit/mq/vertx/VertxMqProducer.java → iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/VertxMqProducer.java

@@ -1,4 +1,4 @@
-package cc.iotkit.mq.vertx;
+package cc.iotkit.vertx;
 
 import cc.iotkit.mq.MqProducer;
 import io.vertx.core.AbstractVerticle;

+ 27 - 0
iot-message-bus/iot-vertx-event-bus/src/main/java/cc/iotkit/vertx/config/VertxConfig.java

@@ -0,0 +1,27 @@
+package cc.iotkit.vertx.config;
+
+import cc.iotkit.model.device.message.ThingModelMessage;
+import cc.iotkit.mq.MqConsumer;
+import cc.iotkit.mq.MqProducer;
+import cc.iotkit.vertx.VertxMqConsumer;
+import cc.iotkit.vertx.VertxMqProducer;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class VertxConfig {
+
+    @ConditionalOnMissingBean
+    @Bean
+    public MqProducer<ThingModelMessage> getThingModelMessageProducer() {
+        return new VertxMqProducer<>(ThingModelMessage.class);
+    }
+
+    @ConditionalOnMissingBean
+    @Bean
+    public MqConsumer<ThingModelMessage> getThingModelMessageConsumer() {
+        return new VertxMqConsumer<>(ThingModelMessage.class);
+    }
+
+}

+ 2 - 2
iot-message-bus/src/test/java/test/MsgPubConsumeTest.java → iot-message-bus/iot-vertx-event-bus/src/test/java/test/MsgPubConsumeTest.java

@@ -1,8 +1,8 @@
 package test;
 
 import cc.iotkit.mq.ConsumerHandler;
-import cc.iotkit.mq.vertx.VertxMqConsumer;
-import cc.iotkit.mq.vertx.VertxMqProducer;
+import cc.iotkit.vertx.VertxMqConsumer;
+import cc.iotkit.vertx.VertxMqProducer;
 import io.vertx.core.AsyncResult;
 import io.vertx.core.Handler;
 import io.vertx.core.Vertx;

+ 8 - 1
iot-message-bus/pom.xml

@@ -5,12 +5,19 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
+    <packaging>pom</packaging>
 
     <artifactId>iot-message-bus</artifactId>
 
+    <modules>
+        <module>iot-message-core</module>
+        <module>iot-vertx-event-bus</module>
+        <module>iot-message-rocketmq</module>
+    </modules>
+
     <dependencies>
 
         <dependency>

+ 1 - 1
iot-package/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 2 - 2
iot-rule-engine/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -68,7 +68,7 @@
 
         <dependency>
             <groupId>cc.iotkit</groupId>
-            <artifactId>iot-message-bus</artifactId>
+            <artifactId>iot-message-core</artifactId>
         </dependency>
 
     </dependencies>

+ 0 - 11
iot-rule-engine/src/main/java/cc/iotkit/ruleengine/config/RuleConfiguration.java

@@ -11,14 +11,9 @@ package cc.iotkit.ruleengine.config;
 
 import cc.iotkit.model.device.message.ThingModelMessage;
 import cc.iotkit.mq.MqConsumer;
-import cc.iotkit.mq.MqProducer;
-import cc.iotkit.mq.vertx.VertxMqConsumer;
-import cc.iotkit.mq.vertx.VertxMqProducer;
 import cc.iotkit.ruleengine.handler.RuleDeviceConsumer;
 import cc.iotkit.ruleengine.rule.RuleMessageHandler;
 import cc.iotkit.ruleengine.task.TaskManager;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -32,12 +27,6 @@ public class RuleConfiguration {
         return new RuleDeviceConsumer(consumer, Collections.singletonList(ruleMessageHandler));
     }
 
-    @ConditionalOnMissingBean
-    @Bean
-    public MqConsumer<ThingModelMessage> getThingModelMessageConsumer() {
-        return new VertxMqConsumer<>(ThingModelMessage.class);
-    }
-
     @Bean
     public TaskManager getTaskManager() {
         return new TaskManager();

+ 9 - 0
iot-rule-engine/src/main/java/cc/iotkit/ruleengine/expression/NeqComparator.java

@@ -1,3 +1,12 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
 package cc.iotkit.ruleengine.expression;
 
 

BIN
iot-standalone/.DS_Store


+ 20 - 8
iot-standalone/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -123,31 +123,43 @@
 
         <dependency>
             <groupId>cc.iotkit</groupId>
-            <artifactId>iot-message-bus</artifactId>
+            <artifactId>iot-message-core</artifactId>
         </dependency>
 
+        <!--内置消息总线-->
+<!--        <dependency>-->
+<!--            <groupId>cc.iotkit</groupId>-->
+<!--            <artifactId>iot-vertx-event-bus</artifactId>-->
+<!--        </dependency>-->
+
+        <!--打开注释使用rocketmq消息总线-->
         <dependency>
             <groupId>cc.iotkit</groupId>
-            <artifactId>iot-temporal-service</artifactId>
+            <artifactId>iot-message-rocketmq</artifactId>
         </dependency>
 
         <dependency>
             <groupId>cc.iotkit</groupId>
-            <artifactId>iot-rdb-data-service</artifactId>
+            <artifactId>iot-temporal-service</artifactId>
         </dependency>
 
-        <!--打开注释 启用es数据库-->
         <dependency>
             <groupId>cc.iotkit</groupId>
-            <artifactId>iot-es-temporal-service</artifactId>
+            <artifactId>iot-rdb-data-service</artifactId>
         </dependency>
 
-        <!--打开注释 启用tdengine数据库-->
+        <!--打开注释 启用es数据库-->
         <!--        <dependency>-->
         <!--            <groupId>cc.iotkit</groupId>-->
-        <!--            <artifactId>iot-td-temporal-service</artifactId>-->
+        <!--            <artifactId>iot-es-temporal-service</artifactId>-->
         <!--        </dependency>-->
 
+        <!--打开注释 启用tdengine数据库-->
+        <dependency>
+            <groupId>cc.iotkit</groupId>
+            <artifactId>iot-td-temporal-service</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>cc.iotkit</groupId>
             <artifactId>iot-data-cache</artifactId>

+ 1 - 1
iot-standalone/src/main/java/cc/iotkit/manager/controller/ProductController.java

@@ -104,7 +104,7 @@ public class ProductController {
             dbStructureData.defineThingModel(thingModel);
         } else {
             //更新时序数据库物模型数据结构
-            dbStructureData.undefineThingModel(thingModel);
+            dbStructureData.updateThingModel(thingModel);
         }
         thingModelData.save(thingModel);
     }

+ 19 - 13
iot-standalone/src/main/resources/application-dev.yml

@@ -55,22 +55,22 @@ spring:
   # ============mysql配置结束============>>
 
   #<<================es时序数据配置开始===============
-  #  elasticsearch:
-  #    rest:
-  #      #使用内置es的配置
-  #      #uris: http://elasticsearch:9200
-  #      uris: http://127.0.0.1:9200
-  #      username:
-  #      password:
-  #      connection-timeout: 10s
+  elasticsearch:
+    rest:
+      #使用内置es的配置
+      #uris: http://elasticsearch:9200
+      uris: http://127.0.0.1:9200
+      username:
+      password:
+      connection-timeout: 10s
   #================es时序数据配置结束===============>>
 
   #<<===========tdengine时序数据库配置开始============
-  td-datasource:
-    url: jdbc:TAOS-RS://127.0.0.1:6041/iotkit?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
-    username: root
-    password: taosdata
-    driverClassName: com.taosdata.jdbc.rs.RestfulDriver
+#  td-datasource:
+#    url: jdbc:TAOS-RS://127.0.0.1:6041/iotkit?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
+#    username: root
+#    password: taosdata
+#    driverClassName: com.taosdata.jdbc.rs.RestfulDriver
   #===========tdengine时序数据库配置开始============>>
 
 
@@ -86,6 +86,12 @@ spring:
     pathmatch:
       matching-strategy: ant_path_matcher
 
+#application.yml中打开注释支持rocketMq作为消息总线,pom.xml中打开注释使用rocketmq消息总线
+#rocketmq:
+#  name-server: 127.0.0.1:9876
+#  producer:
+#        group: iotkit
+
 #图片存储用的是阿里云oss,如果需要上传产品图片才需要配置
 aliyun:
   bucketId:

+ 6 - 0
iot-standalone/src/main/resources/application-mysql.yml

@@ -67,6 +67,12 @@ aliyun:
   accessKeyId:
   accessKeySecret:
 
+#application.yml中打开注释支持rocketMq作为消息总线,pom.xml中打开注释使用rocketmq消息总线
+#rocketmq:
+#  name-server: 127.0.0.1:9876
+#  producer:
+#        group: iotkit
+
 sa-token:
   # token名称 (同时也是cookie名称)
   token-name: token

+ 6 - 0
iot-standalone/src/main/resources/application.yml

@@ -86,6 +86,12 @@ spring:
     pathmatch:
       matching-strategy: ant_path_matcher
 
+#application.yml中打开注释支持rocketMq作为消息总线,pom.xml中打开注释使用rocketmq消息总线
+#rocketmq:
+#  name-server: 172.16.1.113:9876
+#  producer:
+#        group: iotkit
+
 #图片存储用的是阿里云oss,如果需要上传产品图片才需要配置
 aliyun:
   bucketId:

BIN
iot-test-tool/iot-test-mqtt/.DS_Store


+ 2 - 2
iot-test-tool/iot-test-mqtt/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iot-test-tool</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -58,7 +58,7 @@
                         <configuration>
                             <archive>
                                 <manifest>
-                                    <mainClass>cc.iotkit.simulator.Application</mainClass>
+                                    <mainClass>cc.iotkit.test.mqtt.performance.ReportTest</mainClass>
                                 </manifest>
                             </archive>
                             <descriptorRefs>

+ 1 - 4
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/performance/ReportTest.java

@@ -35,6 +35,7 @@ public class ReportTest {
         if (args.length == 0) {
             Mqtt.brokerHost = "127.0.0.1";
 //            Mqtt.brokerHost = "120.76.96.206";
+//            Mqtt.brokerHost = "172.16.1.109";
         } else {
             Mqtt.brokerHost = args[0];
         }
@@ -60,10 +61,6 @@ public class ReportTest {
                         "TEST_SC_" + StringUtils.leftPad(finalI + "", 6, "0"),
                         "S01");
 
-                gateway.addSubDevice("xpsYHExTKPFaQMS7",
-                        "TEST_LT_" + StringUtils.leftPad(finalI + "", 6, "0"),
-                        "L01");
-
                 gateway.onDeviceOnline((device) -> {
                     String pk = device.getProductKey();
                     if (!"Rf4QSjbm65X45753".equals(pk)) {

+ 1 - 1
iot-test-tool/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>pom</packaging>

+ 1 - 1
iot-virtual-device/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>iotkit-parent</artifactId>
         <groupId>cc.iotkit</groupId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.4.2-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 14 - 3
pom.xml

@@ -14,7 +14,6 @@
         <module>iot-message-bus</module>
         <module>iot-test-tool</module>
         <module>iot-data</module>
-        <module>iot-data/iot-td-temporal-service</module>
     </modules>
     <parent>
         <groupId>org.springframework.boot</groupId>
@@ -25,7 +24,7 @@
 
     <groupId>cc.iotkit</groupId>
     <artifactId>iotkit-parent</artifactId>
-    <version>0.4.1-SNAPSHOT</version>
+    <version>0.4.2-SNAPSHOT</version>
     <name>iotkit-parent</name>
     <description>iotkit parent</description>
     <properties>
@@ -271,7 +270,19 @@
 
             <dependency>
                 <groupId>cc.iotkit</groupId>
-                <artifactId>iot-message-bus</artifactId>
+                <artifactId>iot-message-core</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>cc.iotkit</groupId>
+                <artifactId>iot-vertx-event-bus</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>cc.iotkit</groupId>
+                <artifactId>iot-message-rocketmq</artifactId>
                 <version>${project.version}</version>
             </dependency>