diff --git a/.gitignore b/.gitignore index 850083ff..6b1fce17 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,4 @@ hs_err_pid* /thinglinks-visual/*/target *.iml doc/ -src/ +/src/ diff --git a/doc/nacos-config/DEFAULT_GROUP/rocketmq.yml b/doc/nacos-config/DEFAULT_GROUP/rocketmq.yml deleted file mode 100644 index 89e4231d..00000000 --- a/doc/nacos-config/DEFAULT_GROUP/rocketmq.yml +++ /dev/null @@ -1,26 +0,0 @@ -rocketmq: - consumer: - group: thinglinks - # ACL 开启时填写(未开启为空即可) - accessKey: - secretKey: - # 一次拉取消息最大值,注意是拉取消息的最大值而非消费最大值 - pull-batch-size: 10 - name-server: 127.0.0.1:19876 - producer: - # 发送同一类消息的设置为同一个group,保证唯一 - group: thinglinks - accessKey: - secretKey: - # 发送消息超时时间,默认3000 - sendMessageTimeout: 10000 - # 发送消息失败重试次数,默认2 - retryTimesWhenSendFailed: 2 - # 异步消息重试此处,默认2 - retryTimesWhenSendAsyncFailed: 2 - # 消息最大长度,默认1024 * 1024 * 4(默认4M) - maxMessageSize: 4096 - # 压缩消息阈值,默认4k(1024 * 4) - compressMessageBodyThreshold: 4096 - # 是否在内部发送失败时重试另一个broker,默认false - retryNextServer: false diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-gen.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-gen.yml index f34cbfc7..9fc99383 100755 --- a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-gen.yml +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-gen.yml @@ -13,7 +13,7 @@ mybatis: swagger: title: 代码生成接口文档 license: Powered By thinglinks - licenseUrl: https://doc.thinglinks.mqttsnet.com + licenseUrl: http://www.mqttsnet.com/ # 代码生成 gen: diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-job.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-job.yml index f2849120..594cc872 100755 --- a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-job.yml +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-job.yml @@ -13,4 +13,4 @@ mybatis: swagger: title: 定时任务接口文档 license: Powered By thinglinks - licenseUrl: https://doc.thinglinks.mqttsnet.com + licenseUrl: http://www.mqttsnet.com/ diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-system.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-system.yml index 5452c0d3..939f7c45 100755 --- a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-system.yml +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-system.yml @@ -13,4 +13,4 @@ mybatis: swagger: title: 系统模块接口文档 license: Powered By thinglinks - licenseUrl: https://doc.thinglinks.mqttsnet.com \ No newline at end of file + licenseUrl: http://www.mqttsnet.com/ \ No newline at end of file diff --git a/pom.xml b/pom.xml index 7b5a2b35..7f6c3c33 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ 1.2.0.RELEASE UTF-8 UTF-8 - 1.8 + 17 2.7.7 2021.0.5 2021.0.4.0 @@ -48,8 +48,8 @@ UTF-8 UTF-8 - 1.8 - 1.8 + 17 + 17 1.4.12 mqttsnet diff --git a/src/main/filters/config-dev.properties b/src/main/filters/config-dev.properties index e094f488..01bc9111 100644 --- a/src/main/filters/config-dev.properties +++ b/src/main/filters/config-dev.properties @@ -1,19 +1,20 @@ -# \u5728\u8FD9\u4E2A\u914D\u7F6E\u6587\u4EF6\u4E2D\u914D\u7F6E\u7684\u5C5E\u6027\uFF0C\u662F\u6240\u6709\u670D\u52A1\u5747\u9700\u8981\u7684\u7EDF\u4E00\u7684\u914D\u7F6E\uFF0C\u4E14\u4E0D\u80FD\u914D\u7F6E\u5728nacos\u4E2D -# \u5FAE\u670D\u52A1\u5BA2\u6237\u7AEF\u9700\u8981 \u914D\u7F6E\u7684 nacos \u670D\u52A1\u7AEF\u7684ip\u7B49\u4FE1\u606F -nacos.ip=124.223.113.139 -nacos.port=18848 -# \u72EC\u7ACB\u547D\u540D\u7A7A\u95F4\u907F\u514D\u8DDF\u522B\u7684\u9879\u76EE\u51B2\u7A81 -nacos.namespace=9507457f-fe75-43ad-a48a-40f6ffc60b8f -nacos.username=thinglinks-test -nacos.password=12345678 +# 在这个配置文件中配置的属性,是所有服务均需要的统一的配置,且不能配置在nacos中 +# 微服务客户端需要配置的nacos服务端的ip等信息 +nacos.ip=127.0.0.1 +nacos.port=8848 +nacos.namespace=7b0a0646-fdeb-483f-b4c8-9024f8920be9 +nacos.username=nacos +nacos.password=nacos +# 微服务注册到nacos的ip(确保微服务使用正确的 IP 地址进行注册) +nacos.discovery.ip=127.0.0.1 -# seata \u5BA2\u6237\u7AEF\u4ECE nacos \u62C9\u53D6\u914D\u7F6E\u548C\u6CE8\u518C\u7684\u547D\u540D\u7A7A\u95F4 \u8DDF nacos.namespace \u533A\u5206\u51FA\u6765\uFF0C\u539F\u56E0\u662F seata -seata.namespace=23a01bfb-11c2-4a33-811f-8b57131a4d10 -# seata \u7684 grouplist ip +# seata 客户端从 nacos 拉取配置和注册的命名空间 跟 nacos.namespace 区分开来,原因为 seata +seata.namespace=f65008d9-37f1-45ce-88eb-fba641041065 +# seata 的 grouplist ip seata.ip=127.0.0.1 -# seata \u7684 grouplist \u7AEF\u53E3 +# seata 的 grouplist 端口 seata.port=8091 -# \u65E5\u5FD7\u5B58\u50A8\u8DEF\u5F84 -logging.file.path=/usr/local/mqtts/logs -# sentinel \u63A7\u5236\u53F0 +# 日志存储路径 +logging.file.path=/data01/mqttsnet/data_dev/logs +# sentinel 控制台的地址 sentinel.dashboard=127.0.0.1:8088 diff --git a/src/main/filters/config-prod.properties b/src/main/filters/config-prod.properties index 9b7c78e0..da90611e 100644 --- a/src/main/filters/config-prod.properties +++ b/src/main/filters/config-prod.properties @@ -1,19 +1,20 @@ -# \u5728\u8FD9\u4E2A\u914D\u7F6E\u6587\u4EF6\u4E2D\u914D\u7F6E\u7684\u5C5E\u6027\uFF0C\u662F\u6240\u6709\u670D\u52A1\u5747\u9700\u8981\u7684\u7EDF\u4E00\u7684\u914D\u7F6E\uFF0C\u4E14\u4E0D\u80FD\u914D\u7F6E\u5728nacos\u4E2D -# \u5FAE\u670D\u52A1\u5BA2\u6237\u7AEF\u9700\u8981 \u914D\u7F6E\u7684 nacos \u670D\u52A1\u7AEF\u7684ip\u7B49\u4FE1\u606F +# 在这个配置文件中配置的属性,是所有服务均需要的统一的配置,且不能配置在nacos中 +# 微服务客户端需要配置的nacos服务端的ip等信息 nacos.ip=127.0.0.1 nacos.port=8848 -# \u72EC\u7ACB\u547D\u540D\u7A7A\u95F4\u907F\u514D\u8DDF\u522B\u7684\u9879\u76EE\u51B2\u7A81 -nacos.namespace=23a01bfb-11c2-4a33-811f-8b57131a4d10 +nacos.namespace=7b0a0646-fdeb-483f-b4c8-9024f8920be9 nacos.username=nacos -nacos.password=123456 +nacos.password=nacos +# 微服务注册到nacos的ip(确保微服务使用正确的 IP 地址进行注册) +nacos.discovery.ip=127.0.0.1 -# seata \u5BA2\u6237\u7AEF\u4ECE nacos \u62C9\u53D6\u914D\u7F6E\u548C\u6CE8\u518C\u7684\u547D\u540D\u7A7A\u95F4 \u8DDF nacos.namespace \u533A\u5206\u51FA\u6765\uFF0C\u539F\u56E0\u662F seata -seata.namespace=23a01bfb-11c2-4a33-811f-8b57131a4d10 -# seata \u7684 grouplist ip +# seata 客户端从 nacos 拉取配置和注册的命名空间 跟 nacos.namespace 区分开来,原因为 seata +seata.namespace=f65008d9-37f1-45ce-88eb-fba641041065 +# seata 的 grouplist ip seata.ip=127.0.0.1 -# seata \u7684 grouplist \u7AEF\u53E3 +# seata 的 grouplist 端口 seata.port=8091 -# \u65E5\u5FD7\u5B58\u50A8\u8DEF\u5F84 -logging.file.path=/usr/local/mqtts/logs -# sentinel \u63A7\u5236\u53F0 +# 日志存储路径 +logging.file.path=/data01/mqttsnet/data_prod/logs +# sentinel 控制台的地址 sentinel.dashboard=127.0.0.1:8088 diff --git a/src/main/filters/config-release.properties b/src/main/filters/config-release.properties new file mode 100644 index 00000000..e6839e8d --- /dev/null +++ b/src/main/filters/config-release.properties @@ -0,0 +1,20 @@ +# 在这个配置文件中配置的属性,是所有服务均需要的统一的配置,且不能配置在nacos中 +# 微服务客户端需要配置的nacos服务端的ip等信息 +nacos.ip=127.0.0.1 +nacos.port=8848 +nacos.namespace=7b0a0646-fdeb-483f-b4c8-9024f8920be9 +nacos.username=nacos +nacos.password=nacos +# 微服务注册到nacos的ip(确保微服务使用正确的 IP 地址进行注册) +nacos.discovery.ip=127.0.0.1 + +# seata 客户端从 nacos 拉取配置和注册的命名空间 跟 nacos.namespace 区分开来,原因为 seata +seata.namespace=f65008d9-37f1-45ce-88eb-fba641041065 +# seata 的 grouplist ip +seata.ip=127.0.0.1 +# seata 的 grouplist 端口 +seata.port=8091 +# 日志存储路径 +logging.file.path=/data01/mqttsnet/data_release/logs +# sentinel 控制台的地址 +sentinel.dashboard=127.0.0.1:8088 diff --git a/src/main/filters/config-test.properties b/src/main/filters/config-test.properties new file mode 100644 index 00000000..e5305121 --- /dev/null +++ b/src/main/filters/config-test.properties @@ -0,0 +1,20 @@ +# 在这个配置文件中配置的属性,是所有服务均需要的统一的配置,且不能配置在nacos中 +# 微服务客户端需要配置的nacos服务端的ip等信息 +nacos.ip=127.0.0.1 +nacos.port=8848 +nacos.namespace=7b0a0646-fdeb-483f-b4c8-9024f8920be9 +nacos.username=nacos +nacos.password=nacos +# 微服务注册到nacos的ip(确保微服务使用正确的 IP 地址进行注册) +nacos.discovery.ip=127.0.0.1 + +# seata 客户端从 nacos 拉取配置和注册的命名空间 跟 nacos.namespace 区分开来,原因为 seata +seata.namespace=f65008d9-37f1-45ce-88eb-fba641041065 +# seata 的 grouplist ip +seata.ip=127.0.0.1 +# seata 的 grouplist 端口 +seata.port=8091 +# 日志存储路径 +logging.file.path=/data01/mqttsnet/data_test/logs +# sentinel 控制台的地址 +sentinel.dashboard=127.0.0.1:8088 diff --git a/thinglinks-auth/Dockerfile b/thinglinks-auth/Dockerfile index aff2d01d..65ccb97f 100644 --- a/thinglinks-auth/Dockerfile +++ b/thinglinks-auth/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19200/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-auth/src/main/resources/bootstrap.yml b/thinglinks-auth/src/main/resources/bootstrap.yml index 10dadc37..37f83528 100644 --- a/thinglinks-auth/src/main/resources/bootstrap.yml +++ b/thinglinks-auth/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ # Spring -spring: +spring: application: # 应用名称 name: @project.artifactId@ @@ -35,3 +35,4 @@ spring: refresh: true username: @nacos.username@ password: @nacos.password@ + diff --git a/thinglinks-auth/src/main/resources/logback.xml b/thinglinks-auth/src/main/resources/logback.xml index 96a75ce3..1b44fc41 100644 --- a/thinglinks-auth/src/main/resources/logback.xml +++ b/thinglinks-auth/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-common/pom.xml b/thinglinks-common/pom.xml index 8203b209..41971ed5 100644 --- a/thinglinks-common/pom.xml +++ b/thinglinks-common/pom.xml @@ -16,7 +16,6 @@ thinglinks-common-security thinglinks-common-datascope thinglinks-common-datasource - thinglinks-common-rocketmq thinglinks-common-job thinglinks-common-kafka thinglinks-common-seata diff --git a/thinglinks-common/thinglinks-common-core/src/main/java/com/mqttsnet/thinglinks/common/core/dynamicCompilation/bytecode/InjectionSystem.java b/thinglinks-common/thinglinks-common-core/src/main/java/com/mqttsnet/thinglinks/common/core/dynamicCompilation/bytecode/InjectionSystem.java index d0043b76..f0dde05a 100644 --- a/thinglinks-common/thinglinks-common-core/src/main/java/com/mqttsnet/thinglinks/common/core/dynamicCompilation/bytecode/InjectionSystem.java +++ b/thinglinks-common/thinglinks-common-core/src/main/java/com/mqttsnet/thinglinks/common/core/dynamicCompilation/bytecode/InjectionSystem.java @@ -148,7 +148,7 @@ public static void runFinalization() { @Deprecated public static void runFinalizersOnExit(boolean value) { - System.runFinalizersOnExit(value); + System.gc(); } public static void load(String filename) { diff --git a/thinglinks-common/thinglinks-common-rocketmq/pom.xml b/thinglinks-common/thinglinks-common-rocketmq/pom.xml deleted file mode 100644 index be5df8bf..00000000 --- a/thinglinks-common/thinglinks-common-rocketmq/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - com.mqttsnet - thinglinks-common - ${thinglinks.version} - - 4.0.0 - - thinglinks-common-rocketmq - - - thinglinks-common-rocketmq消息服务 - - - - - - - org.apache.rocketmq - rocketmq-spring-boot-starter - 2.2.3 - - - - - com.mqttsnet - thinglinks-common-core - ${thinglinks.version} - - - - \ No newline at end of file diff --git a/thinglinks-common/thinglinks-common-rocketmq/src/main/java/com/mqttsnet/thinglinks/common/rocketmq/domain/MQMessage.java b/thinglinks-common/thinglinks-common-rocketmq/src/main/java/com/mqttsnet/thinglinks/common/rocketmq/domain/MQMessage.java deleted file mode 100644 index 1765aaa0..00000000 --- a/thinglinks-common/thinglinks-common-rocketmq/src/main/java/com/mqttsnet/thinglinks/common/rocketmq/domain/MQMessage.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.mqttsnet.thinglinks.common.rocketmq.domain; - -import lombok.Data; - -/** - * @Description: MQ消息 - * @Author: ShiHuan SUN - * @E-mail: 13733918655@163.com - * @Website: http://thinglinks.mqttsnet.com - * @CreateDate: 2022/4/15$ 16:15$ - * @UpdateUser: ShiHuan SUN - * @UpdateDate: 2022/4/15$ 16:15$ - * @UpdateRemark: 修改内容 - * @Version: V1.0 - */ -@Data -public class MQMessage { - private static final long serialVersionUID = 1L; - - /** - * 主题 - */ - private String topic; - - /** - * 消息 - */ - private String message; -} diff --git a/thinglinks-common/thinglinks-common-rocketmq/src/main/java/com/mqttsnet/thinglinks/common/rocketmq/produtor/RocketMQTemplateProducer.java b/thinglinks-common/thinglinks-common-rocketmq/src/main/java/com/mqttsnet/thinglinks/common/rocketmq/produtor/RocketMQTemplateProducer.java deleted file mode 100644 index 1860e239..00000000 --- a/thinglinks-common/thinglinks-common-rocketmq/src/main/java/com/mqttsnet/thinglinks/common/rocketmq/produtor/RocketMQTemplateProducer.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.mqttsnet.thinglinks.common.rocketmq.produtor; - -import com.alibaba.fastjson.JSON; -import lombok.extern.slf4j.Slf4j; -import org.apache.rocketmq.client.producer.SendCallback; -import org.apache.rocketmq.client.producer.SendResult; -import org.apache.rocketmq.client.producer.TransactionSendResult; -import org.apache.rocketmq.spring.core.RocketMQTemplate; -import org.apache.rocketmq.spring.support.RocketMQHeaders; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.messaging.Message; -import org.springframework.messaging.support.MessageBuilder; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.UUID; - -/** - * @Description: Rocketmq生产者 - * @Author: ShiHuan SUN - * @E-mail: 13733918655@163.com - * @Website: http://thinglinks.mqttsnet.com - * @CreateDate: 2022/8/24$ 15:53$ - * @UpdateUser: ShiHuan SUN - * @UpdateDate: 2022/8/24$ 15:53$ - * @UpdateRemark: 修改内容 - * @Version: V1.0 - */ -@Slf4j -@Service -public class RocketMQTemplateProducer { - - @Autowired - private RocketMQTemplate template; - - /** - * 发送普通消息 - * - * @param topic topic - * @param message 消息体 - */ - public void sendMessage(String topic, Object message) { - this.template.convertAndSend(topic, message); - log.info("普通消息发送完成:message = {}", message); - } - - /** - * 发送同步消息 - * - * @param topic topic - * @param message 消息体 - */ - public void syncSendMessage(String topic, Object message) { - SendResult sendResult = this.template.syncSend(topic, message); - log.info("同步发送消息完成:message = {}, sendResult = {}", message, sendResult); - } - - /** - * 发送异步消息 - * - * @param topic topic - * @param message 消息体 - */ - public void asyncSendMessage(String topic, Object message) { - this.template.asyncSend(topic, message, new SendCallback() { - @Override - public void onSuccess(SendResult sendResult) { - log.info("异步消息发送成功,message = {}, SendStatus = {}", message, sendResult.getSendStatus()); - } - - @Override - public void onException(Throwable e) { - log.info("异步消息发送异常,exception = {}", e.getMessage()); - } - }); - } - - /** - * 发送单向消息(只负责发送消息,不等待应答,不关心发送结果,如日志) - * - * @param topic topic - * @param message 消息体 - */ - public void sendOneWayMessage(String topic, Object message) { - this.template.sendOneWay(topic, message); - log.info("单向发送消息完成:message = {}", message); - } - - /** - * 同步发送批量消息 - * - * @param topic topic - * @param messageList 消息集合 - * @param timeout 超时时间(毫秒) - */ - public void syncSendMessages(String topic, List> messageList, long timeout) { - this.template.syncSend(topic, messageList, timeout); - log.info("同步发送批量消息完成:message = {}", JSON.toJSONString(messageList)); - } - - /** - * 发送事务消息 - * - * @param topic topic - * @param message 消息对象 - */ - public void sendMessageInTransaction(String topic, Object message) { - String transactionId = UUID.randomUUID().toString(); - TransactionSendResult result = this.template.sendMessageInTransaction(topic, MessageBuilder.withPayload(message) - .setHeader(RocketMQHeaders.TRANSACTION_ID, transactionId) - .build(), message); - log.info("发送事务消息(半消息)完成:result = {}", result); - } - - /** - * 发送携带 tag 的消息(过滤消息) - * - * @param topic topic,RocketMQTemplate将 topic 和 tag 合二为一了,底层会进行 - * 拆分再组装。只要在指定 topic 时跟上 {:tags} 就可以指定tag - * 例如 test-topic:tagA - * @param tag 标签 - * @param message 消息体 - */ - public void syncSendMessageWithTag(String topic, String tag, Object message) { - String newTopic = topic+":"+tag; - this.template.syncSend(newTopic, message); - log.info("发送带 tag 的消息完成:message = {}", message); - } - - /** - * 同步发送延时消息 - * - * @param topic topic - * @param message 消息体 - * @param timeout 超时 - * @param delayLevel 延时等级:现在RocketMq并不支持任意时间的延时,需要设置几个固定的延时等级, - * 从1s到2h分别对应着等级 1 到 18,消息消费失败会进入延时消息队列 - * "1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h"; - */ - public void syncSendDelay(String topic, Object message, long timeout, int delayLevel) { - this.template.syncSend(topic, MessageBuilder.withPayload(message).build(), timeout, delayLevel); - log.info("已同步发送延时消息 message = {}", message); - } - - /** - * 异步发送延时消息 - * - * @param topic topic - * @param message 消息对象 - * @param timeout 超时时间 - * @param delayLevel 延时等级 - */ - public void asyncSendDelay(String topic, Object message, long timeout, int delayLevel) { - this.template.asyncSend(topic, MessageBuilder.withPayload(message).build(), new SendCallback() { - @Override - public void onSuccess(SendResult sendResult) { - log.info("异步发送延时消息成功,message = {}", message); - } - - @Override - public void onException(Throwable throwable) { - log.error("异步发送延时消息发生异常,exception = {}", throwable.getMessage()); - } - }, timeout, delayLevel); - log.info("已异步发送延时消息 message = {}", message); - } - - /** - * 发送单向顺序消息 - * - * @param topic topic - */ - public void sendOneWayOrderly(String topic) { - for (int i = 0; i < 30; i++) { - this.template.sendOneWayOrderly(topic, MessageBuilder.withPayload("message - " + i).build(), "topic"); - log.info("单向顺序发送消息完成:message = {}", "message - " + i); - } - } - - /** - * 同步发送顺序消息 - * - * @param topic topic - */ - public void syncSendOrderly(String topic) { - for (int i = 0; i < 30; i++) { - SendResult sendResult = this.template.syncSendOrderly(topic, MessageBuilder.withPayload("message - " + i).build(), "syncOrderlyKey"); - log.info("同步顺序发送消息完成:message = {}, sendResult = {}", "message - " + i, sendResult); - } - } -} diff --git a/thinglinks-gateway/Dockerfile b/thinglinks-gateway/Dockerfile index e752c35f..3752245f 100644 --- a/thinglinks-gateway/Dockerfile +++ b/thinglinks-gateway/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19100/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-gateway/src/main/resources/bootstrap.yml b/thinglinks-gateway/src/main/resources/bootstrap.yml index 5e202c77..47e82218 100644 --- a/thinglinks-gateway/src/main/resources/bootstrap.yml +++ b/thinglinks-gateway/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ # Spring -spring: +spring: application: # 应用名称 name: @project.artifactId@ @@ -52,3 +52,4 @@ spring: groupId: DEFAULT_GROUP data-type: json rule-type: flow + diff --git a/thinglinks-gateway/src/main/resources/logback.xml b/thinglinks-gateway/src/main/resources/logback.xml index 33a5dbd6..df8df7e6 100644 --- a/thinglinks-gateway/src/main/resources/logback.xml +++ b/thinglinks-gateway/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-modules/thinglinks-modules-broker/Dockerfile b/thinglinks-modules/thinglinks-modules-broker/Dockerfile index a15756ed..df96b137 100644 --- a/thinglinks-modules/thinglinks-modules-broker/Dockerfile +++ b/thinglinks-modules/thinglinks-modules-broker/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19306/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-modules/thinglinks-modules-broker/pom.xml b/thinglinks-modules/thinglinks-modules-broker/pom.xml index 1dd7ac77..27982c07 100644 --- a/thinglinks-modules/thinglinks-modules-broker/pom.xml +++ b/thinglinks-modules/thinglinks-modules-broker/pom.xml @@ -74,12 +74,6 @@ - - - com.mqttsnet - thinglinks-common-rocketmq - ${thinglinks.version} - diff --git a/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/consumer/rocketmq/MqttMessageRocketmqConsumerHandler.java b/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/consumer/rocketmq/MqttMessageRocketmqConsumerHandler.java deleted file mode 100644 index 34e49fb0..00000000 --- a/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/consumer/rocketmq/MqttMessageRocketmqConsumerHandler.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.mqttsnet.thinglinks.broker.mqs.consumer.rocketmq; - - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.mqttsnet.thinglinks.broker.api.domain.enumeration.MqttEventEnum; -import com.mqttsnet.thinglinks.broker.mqs.mqtt.event.publisher.MqttEventPublisher; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.apache.rocketmq.spring.core.RocketMQListener; -import org.springframework.scheduling.annotation.Async; - -import javax.annotation.Resource; -import java.util.Optional; - -/** - * @Description: Mqtt Message Rocketmq模式 消费者 - * @ClassName: MqttMessageRocketmqConsumerHandler - * @Date: 2023/04/28$ 16:11$ - * @author: ShiHuan Sun - */ -@Slf4j -//@Component -//@RocketMQMessageListener(consumerGroup = ConsumerGroupConstant.THINGLINKS_GROUP, topic = ConsumerTopicConstant.Mqtt.THINGLINKS_MQS_MQTT_MSG, messageModel = MessageModel.CLUSTERING) -public class MqttMessageRocketmqConsumerHandler implements RocketMQListener { - - @Resource - private MqttEventPublisher eventPublisher; - - @Async("mqsAsync-mqttMsg") - @Override - public void onMessage(Object message) { - if (null == message) { - log.warn("message cannot be empty {}", message); - return; - } - log.info("ThingLinks物联网平台数据消费-->Received message={}", message); - try { - JSONObject thinglinksMessage = JSON.parseObject(String.valueOf(message)); - String eventStr = Optional.ofNullable(thinglinksMessage.getString("event")) - .orElse(""); - Long tenantId = Optional.ofNullable(thinglinksMessage.getString("tenantId")) - .filter(StringUtils::isNotBlank) - .map(Long::valueOf) - .orElse(null); - if (StringUtils.isEmpty(eventStr) || tenantId == null) { - log.warn("event or tenantId cannot be empty {}", eventStr); - return; - } - Optional optionalEvent = MqttEventEnum.getMqttEventEnum(thinglinksMessage.get("event").toString()); - optionalEvent.ifPresent(event -> { - switch (event) { - case CONNECT: - eventPublisher.publishMqttConnectEvent(MqttEventEnum.CONNECT, thinglinksMessage.toJSONString()); - break; - case CLOSE: - eventPublisher.publishMqttCloseEvent(MqttEventEnum.CLOSE, thinglinksMessage.toJSONString()); - break; - case DISCONNECT: - eventPublisher.publishMqttDisconnectEvent(MqttEventEnum.DISCONNECT, thinglinksMessage.toJSONString()); - break; - case PUBLISH: - eventPublisher.publishMqttPublishEvent(MqttEventEnum.PUBLISH, thinglinksMessage.toJSONString()); - break; - case SUBSCRIBE: - eventPublisher.publishMqttSubscribeEvent(MqttEventEnum.SUBSCRIBE, thinglinksMessage.toJSONString()); - break; - case UNSUBSCRIBE: - eventPublisher.publishMqttUnsubscribeEvent(MqttEventEnum.UNSUBSCRIBE, thinglinksMessage.toJSONString()); - break; - case PING: - eventPublisher.publishMqttPingEvent(MqttEventEnum.PING, thinglinksMessage.toJSONString()); - break; - default: - break; - } - }); - } catch (Exception e) { - log.error("ThingLinks物联网平台数据消费-->消费失败,失败原因:{}", e.getMessage()); - } - } -} diff --git a/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/mqtt/handler/DeviceDatasHandler.java b/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/mqtt/handler/DeviceDatasHandler.java index f3df687f..74f59565 100644 --- a/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/mqtt/handler/DeviceDatasHandler.java +++ b/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/mqtt/handler/DeviceDatasHandler.java @@ -23,12 +23,12 @@ import com.mqttsnet.thinglinks.link.api.RemoteDeviceOpenAnyService; import com.mqttsnet.thinglinks.link.api.domain.cache.device.DeviceCacheVO; import com.mqttsnet.thinglinks.link.api.domain.cache.product.ProductModelCacheVO; +import com.mqttsnet.thinglinks.link.api.domain.device.vo.param.TopoDeviceDataReportParam; import com.mqttsnet.thinglinks.link.api.domain.product.enumeration.ProductTypeEnum; import com.mqttsnet.thinglinks.link.api.domain.product.vo.param.ProductServiceParamVO; import com.mqttsnet.thinglinks.link.api.domain.product.vo.result.ProductPropertyResultVO; import com.mqttsnet.thinglinks.link.api.domain.product.vo.result.ProductResultVO; import com.mqttsnet.thinglinks.link.api.domain.product.vo.result.ProductServiceResultVO; -import com.mqttsnet.thinglinks.link.api.domain.device.vo.param.TopoDeviceDataReportParam; import com.mqttsnet.thinglinks.tdengine.api.RemoteTdEngineService; import com.mqttsnet.thinglinks.tdengine.api.constant.TdsConstants; import com.mqttsnet.thinglinks.tdengine.api.domain.Fields; @@ -187,17 +187,29 @@ protected String processingTopicMessage(Object deviceDataParam) throws Exception R subTable = remoteTdEngineService.createSubTable(tableDTO); if (ResultEnum.SUCCESS.getCode() == subTable.getCode()) { log.info("设备初始化,设备标识:{},服务标识:{},初始化成功", deviceCacheVO.getDeviceIdentification(), service.getServiceCode()); - // 查询新的表结构信息存redis - setProductModelSuperTableCacheVO(Optional.ofNullable(deviceCacheVO.getProductIdentification()).orElse(""), - service.getServiceCode(), deviceCacheVO.getDeviceIdentification(), remoteTdEngineService.describeSuperOrSubTable(superTableName).getData()); + // 查询新的表结构信息存redis,并更新本地变量 + productModelSuperTableCacheVO = Optional.ofNullable( + remoteTdEngineService.describeSuperOrSubTable(superTableName).getData() + ).orElse(Collections.emptyList()); + + setProductModelSuperTableCacheVO( + Optional.ofNullable(deviceCacheVO.getProductIdentification()).orElse(""), + service.getServiceCode(), + deviceCacheVO.getDeviceIdentification(), + productModelSuperTableCacheVO); } else { log.warn("设备初始化 ,设备标识:{},服务标识:{},初始化失败", deviceCacheVO.getDeviceIdentification(), service.getServiceCode()); return; } } else { - setProductModelSuperTableCacheVO(Optional.ofNullable(deviceCacheVO.getProductIdentification()).orElse(""), - service.getServiceCode(), deviceCacheVO.getDeviceIdentification(), existingFields); + productModelSuperTableCacheVO = existingFields; + setProductModelSuperTableCacheVO( + Optional.ofNullable(deviceCacheVO.getProductIdentification()).orElse(""), + service.getServiceCode(), + deviceCacheVO.getDeviceIdentification(), + productModelSuperTableCacheVO + ); } } diff --git a/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/mqtt/handler/factory/AbstractMessageHandler.java b/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/mqtt/handler/factory/AbstractMessageHandler.java index 49f5a69a..c9a52039 100644 --- a/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/mqtt/handler/factory/AbstractMessageHandler.java +++ b/thinglinks-modules/thinglinks-modules-broker/src/main/java/com/mqttsnet/thinglinks/broker/mqs/mqtt/handler/factory/AbstractMessageHandler.java @@ -15,6 +15,7 @@ import java.util.Collections; import java.util.List; +import java.util.concurrent.TimeUnit; /** * @program: thinglinks @@ -85,7 +86,7 @@ protected void setProductModelSuperTableCacheVO(String productIdentification, St List superTableDescribeOpt) { String cacheKey = CacheConstants.DEF_PRODUCT_MODEL_SUPER_TABLE + productIdentification + ":" + serviceCode + ":" + deviceIdentification; redisService.delete(cacheKey); - redisService.setCacheObject(cacheKey, superTableDescribeOpt); + redisService.setCacheObject(cacheKey, superTableDescribeOpt, 10L, TimeUnit.MINUTES); } protected void sendMessage(String topic, String qos, String message, String tenantId) { diff --git a/thinglinks-modules/thinglinks-modules-broker/src/main/resources/bootstrap.yml b/thinglinks-modules/thinglinks-modules-broker/src/main/resources/bootstrap.yml index 91424fcc..4a9af6db 100644 --- a/thinglinks-modules/thinglinks-modules-broker/src/main/resources/bootstrap.yml +++ b/thinglinks-modules/thinglinks-modules-broker/src/main/resources/bootstrap.yml @@ -35,7 +35,5 @@ spring: refresh: true - dataId: kafka.yml refresh: false - - dataId: rocketmq.yml - refresh: false username: @nacos.username@ password: @nacos.password@ \ No newline at end of file diff --git a/thinglinks-modules/thinglinks-modules-broker/src/main/resources/logback.xml b/thinglinks-modules/thinglinks-modules-broker/src/main/resources/logback.xml index d3611a22..1e118a5e 100644 --- a/thinglinks-modules/thinglinks-modules-broker/src/main/resources/logback.xml +++ b/thinglinks-modules/thinglinks-modules-broker/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-modules/thinglinks-modules-file/Dockerfile b/thinglinks-modules/thinglinks-modules-file/Dockerfile index bc8b52d6..7a5679dc 100644 --- a/thinglinks-modules/thinglinks-modules-file/Dockerfile +++ b/thinglinks-modules/thinglinks-modules-file/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19300/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-modules/thinglinks-modules-file/src/main/resources/bootstrap.yml b/thinglinks-modules/thinglinks-modules-file/src/main/resources/bootstrap.yml index 8cba77e6..6fe3b11c 100644 --- a/thinglinks-modules/thinglinks-modules-file/src/main/resources/bootstrap.yml +++ b/thinglinks-modules/thinglinks-modules-file/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ # Spring -spring: +spring: application: # 应用名称 name: @project.artifactId@ @@ -33,7 +33,5 @@ spring: refresh: false - dataId: database.yml refresh: true - - dataId: rocketmq.yml - refresh: false username: @nacos.username@ password: @nacos.password@ \ No newline at end of file diff --git a/thinglinks-modules/thinglinks-modules-file/src/main/resources/logback.xml b/thinglinks-modules/thinglinks-modules-file/src/main/resources/logback.xml index 2673f9cf..76a12121 100644 --- a/thinglinks-modules/thinglinks-modules-file/src/main/resources/logback.xml +++ b/thinglinks-modules/thinglinks-modules-file/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-modules/thinglinks-modules-gen/Dockerfile b/thinglinks-modules/thinglinks-modules-gen/Dockerfile index 9cfd022a..195f8327 100644 --- a/thinglinks-modules/thinglinks-modules-gen/Dockerfile +++ b/thinglinks-modules/thinglinks-modules-gen/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19301/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-modules/thinglinks-modules-gen/src/main/resources/bootstrap.yml b/thinglinks-modules/thinglinks-modules-gen/src/main/resources/bootstrap.yml index 8cba77e6..6fe3b11c 100644 --- a/thinglinks-modules/thinglinks-modules-gen/src/main/resources/bootstrap.yml +++ b/thinglinks-modules/thinglinks-modules-gen/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ # Spring -spring: +spring: application: # 应用名称 name: @project.artifactId@ @@ -33,7 +33,5 @@ spring: refresh: false - dataId: database.yml refresh: true - - dataId: rocketmq.yml - refresh: false username: @nacos.username@ password: @nacos.password@ \ No newline at end of file diff --git a/thinglinks-modules/thinglinks-modules-gen/src/main/resources/logback.xml b/thinglinks-modules/thinglinks-modules-gen/src/main/resources/logback.xml index 561745e3..f957f1f3 100644 --- a/thinglinks-modules/thinglinks-modules-gen/src/main/resources/logback.xml +++ b/thinglinks-modules/thinglinks-modules-gen/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-modules/thinglinks-modules-job/Dockerfile b/thinglinks-modules/thinglinks-modules-job/Dockerfile index 929d5563..bec92272 100644 --- a/thinglinks-modules/thinglinks-modules-job/Dockerfile +++ b/thinglinks-modules/thinglinks-modules-job/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19302/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-modules/thinglinks-modules-job/src/main/resources/bootstrap.yml b/thinglinks-modules/thinglinks-modules-job/src/main/resources/bootstrap.yml index 8cba77e6..6fe3b11c 100644 --- a/thinglinks-modules/thinglinks-modules-job/src/main/resources/bootstrap.yml +++ b/thinglinks-modules/thinglinks-modules-job/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ # Spring -spring: +spring: application: # 应用名称 name: @project.artifactId@ @@ -33,7 +33,5 @@ spring: refresh: false - dataId: database.yml refresh: true - - dataId: rocketmq.yml - refresh: false username: @nacos.username@ password: @nacos.password@ \ No newline at end of file diff --git a/thinglinks-modules/thinglinks-modules-job/src/main/resources/logback.xml b/thinglinks-modules/thinglinks-modules-job/src/main/resources/logback.xml index e7453818..13fcec55 100644 --- a/thinglinks-modules/thinglinks-modules-job/src/main/resources/logback.xml +++ b/thinglinks-modules/thinglinks-modules-job/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-modules/thinglinks-modules-link/Dockerfile b/thinglinks-modules/thinglinks-modules-link/Dockerfile index c146a54c..7290c517 100644 --- a/thinglinks-modules/thinglinks-modules-link/Dockerfile +++ b/thinglinks-modules/thinglinks-modules-link/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19305/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-modules/thinglinks-modules-link/src/main/resources/bootstrap.yml b/thinglinks-modules/thinglinks-modules-link/src/main/resources/bootstrap.yml index dd7fcb63..6ecf5810 100644 --- a/thinglinks-modules/thinglinks-modules-link/src/main/resources/bootstrap.yml +++ b/thinglinks-modules/thinglinks-modules-link/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ # Spring -spring: +spring: application: # 应用名称 name: @project.artifactId@ @@ -33,8 +33,6 @@ spring: refresh: false - dataId: database.yml refresh: true - - dataId: rocketmq.yml - refresh: false - dataId: kafka.yml refresh: false username: @nacos.username@ diff --git a/thinglinks-modules/thinglinks-modules-link/src/main/resources/logback.xml b/thinglinks-modules/thinglinks-modules-link/src/main/resources/logback.xml index 5585855d..9c9a6c50 100644 --- a/thinglinks-modules/thinglinks-modules-link/src/main/resources/logback.xml +++ b/thinglinks-modules/thinglinks-modules-link/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-modules/thinglinks-modules-protocolAnalysis/Dockerfile b/thinglinks-modules/thinglinks-modules-protocolAnalysis/Dockerfile index 3dd28467..14848fc8 100644 --- a/thinglinks-modules/thinglinks-modules-protocolAnalysis/Dockerfile +++ b/thinglinks-modules/thinglinks-modules-protocolAnalysis/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19307/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-modules/thinglinks-modules-protocolAnalysis/pom.xml b/thinglinks-modules/thinglinks-modules-protocolAnalysis/pom.xml index 842891bb..336b6945 100644 --- a/thinglinks-modules/thinglinks-modules-protocolAnalysis/pom.xml +++ b/thinglinks-modules/thinglinks-modules-protocolAnalysis/pom.xml @@ -66,13 +66,6 @@ ${thinglinks.version} - - - com.mqttsnet diff --git a/thinglinks-modules/thinglinks-modules-protocolAnalysis/src/main/resources/bootstrap.yml b/thinglinks-modules/thinglinks-modules-protocolAnalysis/src/main/resources/bootstrap.yml index 8cba77e6..6fe3b11c 100644 --- a/thinglinks-modules/thinglinks-modules-protocolAnalysis/src/main/resources/bootstrap.yml +++ b/thinglinks-modules/thinglinks-modules-protocolAnalysis/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ # Spring -spring: +spring: application: # 应用名称 name: @project.artifactId@ @@ -33,7 +33,5 @@ spring: refresh: false - dataId: database.yml refresh: true - - dataId: rocketmq.yml - refresh: false username: @nacos.username@ password: @nacos.password@ \ No newline at end of file diff --git a/thinglinks-modules/thinglinks-modules-protocolAnalysis/src/main/resources/logback.xml b/thinglinks-modules/thinglinks-modules-protocolAnalysis/src/main/resources/logback.xml index d963cbbe..2d2faa85 100644 --- a/thinglinks-modules/thinglinks-modules-protocolAnalysis/src/main/resources/logback.xml +++ b/thinglinks-modules/thinglinks-modules-protocolAnalysis/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-modules/thinglinks-modules-rule/Dockerfile b/thinglinks-modules/thinglinks-modules-rule/Dockerfile index b127d225..92eeca17 100644 --- a/thinglinks-modules/thinglinks-modules-rule/Dockerfile +++ b/thinglinks-modules/thinglinks-modules-rule/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19308/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-modules/thinglinks-modules-rule/pom.xml b/thinglinks-modules/thinglinks-modules-rule/pom.xml index c5cab27d..7e334e14 100644 --- a/thinglinks-modules/thinglinks-modules-rule/pom.xml +++ b/thinglinks-modules/thinglinks-modules-rule/pom.xml @@ -81,12 +81,6 @@ ${thinglinks.version} - - - com.mqttsnet - thinglinks-common-rocketmq - ${thinglinks.version} - diff --git a/thinglinks-modules/thinglinks-modules-rule/src/main/java/com/mqttsnet/thinglinks/rule/common/consumer/rocketmq/RuleTriggerMessageRocketmqConsumer.java b/thinglinks-modules/thinglinks-modules-rule/src/main/java/com/mqttsnet/thinglinks/rule/common/consumer/rocketmq/RuleTriggerMessageRocketmqConsumer.java deleted file mode 100644 index 5b4b19e1..00000000 --- a/thinglinks-modules/thinglinks-modules-rule/src/main/java/com/mqttsnet/thinglinks/rule/common/consumer/rocketmq/RuleTriggerMessageRocketmqConsumer.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.mqttsnet.thinglinks.rule.common.consumer.rocketmq; - -import com.alibaba.fastjson.JSONObject; -import com.mqttsnet.thinglinks.common.core.mqs.ConsumerGroupConstant; -import com.mqttsnet.thinglinks.common.core.mqs.ConsumerTopicConstant; -import com.mqttsnet.thinglinks.rule.service.RuleDeviceLinkageService; -import lombok.extern.slf4j.Slf4j; -import org.apache.rocketmq.spring.annotation.MessageModel; -import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; -import org.apache.rocketmq.spring.core.RocketMQListener; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; - -/** - * @Description: 规则引擎-触发器规则消息消费(Rocketmq模式) - * @Author: ShiHuan Sun - * @E-mail: 13733918655@163.com - * @Website: http://thinglinks.mqttsnet.com - * @CreateDate: 2022/10/28$ 16:11$ - * @UpdateUser: ShiHuan Sun - * @UpdateDate: 2022/10/28$ 16:11$ - * @UpdateRemark: 修改内容 - * @Version: 1.0 - */ -@Slf4j -//@Component -@RocketMQMessageListener(consumerGroup = ConsumerGroupConstant.THINGLINKS_GROUP, topic = ConsumerTopicConstant.Rule.THINGLINKS_RULE_TRIGGER, messageModel = MessageModel.CLUSTERING) -public class RuleTriggerMessageRocketmqConsumer implements RocketMQListener { - - @Autowired - private RuleDeviceLinkageService ruleDeviceLinkageService; - - @Async("ruleAsync") - @Override - public void onMessage(Object message) { - assert message != null : "message cannot be empty"; - log.info("规则引擎-触发器规则数据消费-->Received message={}", message); - try { - JSONObject json = JSONObject.parseObject(String.valueOf(message)); - Boolean flag = ruleDeviceLinkageService.checkRuleConditions(json.getString("msg")); - log.info("规则匹配结果:{}", flag); - - // 触发器规则匹配成功,执行动作 - if (flag) { - //TODO 触发器规则匹配成功,执行动作 业务逻辑 自行补充 -// ruleDeviceLinkageService.executeRuleAction(json.getString("msg")); - } - } catch (Exception e) { - log.error("规则引擎-触发器规则数据消费-->消费失败,失败原因:{}", e.getMessage()); - } - } -} diff --git a/thinglinks-modules/thinglinks-modules-rule/src/main/java/com/mqttsnet/thinglinks/rule/service/impl/RuleDeviceLinkageServiceImpl.java b/thinglinks-modules/thinglinks-modules-rule/src/main/java/com/mqttsnet/thinglinks/rule/service/impl/RuleDeviceLinkageServiceImpl.java index 6458d22b..80a2bded 100644 --- a/thinglinks-modules/thinglinks-modules-rule/src/main/java/com/mqttsnet/thinglinks/rule/service/impl/RuleDeviceLinkageServiceImpl.java +++ b/thinglinks-modules/thinglinks-modules-rule/src/main/java/com/mqttsnet/thinglinks/rule/service/impl/RuleDeviceLinkageServiceImpl.java @@ -1,15 +1,12 @@ package com.mqttsnet.thinglinks.rule.service.impl; -import com.alibaba.fastjson.JSONObject; import com.mqttsnet.thinglinks.common.core.constant.Constants; import com.mqttsnet.thinglinks.common.core.domain.R; import com.mqttsnet.thinglinks.common.core.enums.ConditionTypeEnum; import com.mqttsnet.thinglinks.common.core.enums.FieldTypeEnum; import com.mqttsnet.thinglinks.common.core.enums.OperatorEnum; import com.mqttsnet.thinglinks.common.core.enums.TriggeringEnum; -import com.mqttsnet.thinglinks.common.core.mqs.ConsumerTopicConstant; import com.mqttsnet.thinglinks.common.core.utils.CompareUtil; -import com.mqttsnet.thinglinks.common.rocketmq.domain.MQMessage; import com.mqttsnet.thinglinks.link.api.*; import com.mqttsnet.thinglinks.link.api.domain.product.entity.Product; import com.mqttsnet.thinglinks.link.api.domain.product.entity.ProductProperties; @@ -25,7 +22,6 @@ import com.mqttsnet.thinglinks.tdengine.api.domain.model.TagsSelectDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; -import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -46,10 +42,6 @@ @Service public class RuleDeviceLinkageServiceImpl implements RuleDeviceLinkageService { - - @Autowired - private RocketMQTemplate rocketMQTemplate; - @Autowired private ActionCommandsService actionCommandsService; @@ -89,16 +81,8 @@ public class RuleDeviceLinkageServiceImpl implements RuleDeviceLinkageService { @Override @Transactional public void triggerDeviceLinkageByRuleIdentification(String ruleIdentification) { - MQMessage mqMessage = new MQMessage(); - mqMessage.setTopic(ConsumerTopicConstant.Rule.THINGLINKS_RULE_TRIGGER); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("msg", ruleIdentification); - mqMessage.setMessage(jsonObject.toJSONString()); - - log.info("topic:{}", mqMessage.getTopic()); - log.info("message:{}", mqMessage.getMessage()); + // TODO API 调用触发规则 - rocketMQTemplate.convertAndSend(mqMessage.getTopic(), mqMessage.getMessage()); } /** diff --git a/thinglinks-modules/thinglinks-modules-rule/src/main/resources/bootstrap.yml b/thinglinks-modules/thinglinks-modules-rule/src/main/resources/bootstrap.yml index 34e7f925..6fe3b11c 100644 --- a/thinglinks-modules/thinglinks-modules-rule/src/main/resources/bootstrap.yml +++ b/thinglinks-modules/thinglinks-modules-rule/src/main/resources/bootstrap.yml @@ -33,7 +33,5 @@ spring: refresh: false - dataId: database.yml refresh: true - - dataId: rocketmq.yml - refresh: false username: @nacos.username@ password: @nacos.password@ \ No newline at end of file diff --git a/thinglinks-modules/thinglinks-modules-rule/src/main/resources/logback.xml b/thinglinks-modules/thinglinks-modules-rule/src/main/resources/logback.xml index 4ce73c70..bddbf680 100644 --- a/thinglinks-modules/thinglinks-modules-rule/src/main/resources/logback.xml +++ b/thinglinks-modules/thinglinks-modules-rule/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-modules/thinglinks-modules-system/Dockerfile b/thinglinks-modules/thinglinks-modules-system/Dockerfile index cdcc35ae..e754585e 100644 --- a/thinglinks-modules/thinglinks-modules-system/Dockerfile +++ b/thinglinks-modules/thinglinks-modules-system/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19303/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-modules/thinglinks-modules-system/src/main/resources/bootstrap.yml b/thinglinks-modules/thinglinks-modules-system/src/main/resources/bootstrap.yml index 8cba77e6..6fe3b11c 100644 --- a/thinglinks-modules/thinglinks-modules-system/src/main/resources/bootstrap.yml +++ b/thinglinks-modules/thinglinks-modules-system/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ # Spring -spring: +spring: application: # 应用名称 name: @project.artifactId@ @@ -33,7 +33,5 @@ spring: refresh: false - dataId: database.yml refresh: true - - dataId: rocketmq.yml - refresh: false username: @nacos.username@ password: @nacos.password@ \ No newline at end of file diff --git a/thinglinks-modules/thinglinks-modules-system/src/main/resources/logback.xml b/thinglinks-modules/thinglinks-modules-system/src/main/resources/logback.xml index 49403a19..8a8382a1 100644 --- a/thinglinks-modules/thinglinks-modules-system/src/main/resources/logback.xml +++ b/thinglinks-modules/thinglinks-modules-system/src/main/resources/logback.xml @@ -1,7 +1,7 @@ - + @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-modules/thinglinks-modules-tdengine/Dockerfile b/thinglinks-modules/thinglinks-modules-tdengine/Dockerfile index 4d6a6f95..2293bc4e 100644 --- a/thinglinks-modules/thinglinks-modules-tdengine/Dockerfile +++ b/thinglinks-modules/thinglinks-modules-tdengine/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19304/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-modules/thinglinks-modules-tdengine/src/main/resources/logback.xml b/thinglinks-modules/thinglinks-modules-tdengine/src/main/resources/logback.xml index 84706b70..0e208334 100644 --- a/thinglinks-modules/thinglinks-modules-tdengine/src/main/resources/logback.xml +++ b/thinglinks-modules/thinglinks-modules-tdengine/src/main/resources/logback.xml @@ -21,11 +21,9 @@ ${log.path}/all.%d{yyyy-MM-dd}.log 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + 100MB @@ -42,11 +40,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + INFO @@ -66,11 +62,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + WARN @@ -90,11 +84,9 @@ 30 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - - + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ERROR @@ -112,10 +104,6 @@ - - - - diff --git a/thinglinks-ui/.env.development b/thinglinks-ui/.env.development index ab110dcc..e73899b8 100644 --- a/thinglinks-ui/.env.development +++ b/thinglinks-ui/.env.development @@ -5,7 +5,7 @@ VUE_APP_TITLE = ThingLinks物联网一体化平台 ENV = 'development' # ThingLinks物联网一体化平台/开发环境 -VUE_APP_BASE_API = '/dev-api' +VUE_APP_BASE_API = '/api' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/thinglinks-ui/src/api/link/device/device.js b/thinglinks-ui/src/api/link/device/device.js index 6941f82e..193cae44 100644 --- a/thinglinks-ui/src/api/link/device/device.js +++ b/thinglinks-ui/src/api/link/device/device.js @@ -79,11 +79,10 @@ export function validationDeviceIdentification_deviceIdentification(deviceIdenti } // 查询普通设备影子数据 -export function getDeviceShadow(data) { +export function getDeviceShadow(deviceIdentification) { return request({ - url: '/link/shadow/getDeviceShadow', - method: 'post', - data: data + url: '/link/shadow/queryDeviceShadow?deviceIdentification=' + deviceIdentification, + method: 'get', }) } // 查询设备告警信息列表 diff --git a/thinglinks-ui/src/api/link/deviceInfo.js b/thinglinks-ui/src/api/link/deviceInfo.js index 34d2f428..ba2567dd 100644 --- a/thinglinks-ui/src/api/link/deviceInfo.js +++ b/thinglinks-ui/src/api/link/deviceInfo.js @@ -44,10 +44,9 @@ export function delDeviceInfo(id) { } // 查询子设备影子数据 -export function getDeviceInfoShadow(data) { +export function getDeviceInfoShadow(deviceIdentification) { return request({ - url: '/link/deviceInfo/getDeviceInfoShadow', - method: 'post', - data: data + url: '/link/shadow/queryDeviceShadow?deviceIdentification=' + deviceIdentification, + method: 'get', }) } diff --git a/thinglinks-ui/src/api/link/ota/otaList.js b/thinglinks-ui/src/api/link/ota/otaList.js new file mode 100644 index 00000000..1908d0d9 --- /dev/null +++ b/thinglinks-ui/src/api/link/ota/otaList.js @@ -0,0 +1,40 @@ +import request from '@/utils/request' +import { + praseStrEmpty +} from "@/utils/thinglinks"; + +// 查询ota列表 +export function listOta(data) { + return request({ + url: '/link/otaUpgrades/page', + method: 'post', + data: data + }) +} + +// 删除ota +export function deleteOta(data) { + return request({ + url: '/link/otaUpgrades', + method: 'delete', + data: data + }) +} + +// 查询新建ota base信息 +export function getCreateBaseInfo(data) { + return request({ + url: '/oauth/anyUser/dict/findDictMapItemListByKey', + method: 'post', + data: data + }) +} + +// 更新Ota资源 +export function updateOta(data) { + return request({ + url: '/link/otaUpgrades', + method: 'put', + data: data + }) +} \ No newline at end of file diff --git a/thinglinks-ui/src/views/components/device/deviceShaDow.vue b/thinglinks-ui/src/views/components/device/deviceShaDow.vue new file mode 100644 index 00000000..14855f73 --- /dev/null +++ b/thinglinks-ui/src/views/components/device/deviceShaDow.vue @@ -0,0 +1,213 @@ + + + diff --git a/thinglinks-ui/src/views/link/device/detail.vue b/thinglinks-ui/src/views/link/device/detail.vue index 6c697f05..9785ed35 100644 --- a/thinglinks-ui/src/views/link/device/detail.vue +++ b/thinglinks-ui/src/views/link/device/detail.vue @@ -150,40 +150,8 @@ - - - - - - - - - - - - - - - - - - - - 格式化 - - - - - + + @@ -194,9 +162,15 @@ import {getDevice, getDeviceShadow} from "@/api/link/device/device"; import Topic from "@/views/link/device/topic"; import Action from "@/views/link/device/action"; +// components +import DeviceShadow from "@/views/components/device/deviceShaDow.vue"; export default { name: "device-detail", - components: {Action, Topic}, + components: { + Action, + Topic, + [DeviceShadow.name]: DeviceShadow, + }, dicts: [ "link_device_device_type", "link_device_connect_status", @@ -239,7 +213,7 @@ export default { activeName(value) { if (value === 'fourth') { this.data.ids = this.deviceId - this.getShadowData() + this.$refs.deviceShaDow.getShadowData() } }, }, @@ -247,7 +221,7 @@ export default { timeControls() { this.data.startTime = this.value1[0] this.data.endTime = this.value1[1] - this.getShadowData() + this.$refs.deviceShaDow.getShadowData() }, // 查询子设备影子数据 getShadowData() { diff --git a/thinglinks-ui/src/views/link/deviceInfo/equipmentShadow.vue b/thinglinks-ui/src/views/link/deviceInfo/equipmentShadow.vue index 194957a5..ed9c1dea 100644 --- a/thinglinks-ui/src/views/link/deviceInfo/equipmentShadow.vue +++ b/thinglinks-ui/src/views/link/deviceInfo/equipmentShadow.vue @@ -100,50 +100,24 @@ - - - - - - - - - - - - - - - - - - - - 格式化 - - - - - + + + diff --git a/thinglinks-ui/src/views/link/ota/mock/otaList.js b/thinglinks-ui/src/views/link/ota/mock/otaList.js new file mode 100644 index 00000000..ef5ba8d8 --- /dev/null +++ b/thinglinks-ui/src/views/link/ota/mock/otaList.js @@ -0,0 +1,136 @@ +export const otaList = + [ + { + "id": "507495642097988661", + "createdTime": "2024-06-14 13:56:59", + "createdBy": "1452186486253289472", + "updatedTime": "2024-06-18 14:14:07", + "updatedBy": "1452186486253289472", + "echoMap": {}, + "appId": "thinglinks-test", + "packageName": "测试11111", + "packageType": 0, + "productIdentification": "4382169500930048", + "version": "1.3.3", + "fileLocation": "507898505735406629", + "status": 0, + "description": "得到的", + "customInfo": "\"{\\\"b\\\":\\\"nn\\\"}\"", + "remark": "wdd", + "createdOrgId": null + }, + { + "id": "501535275462904951", + "createdTime": "2024-05-28 17:19:23", + "createdBy": "1452186486253289472", + "updatedTime": "2024-06-18 18:19:12", + "updatedBy": "1452186486253289472", + "echoMap": {}, + "appId": "thinglinks-test", + "packageName": "测试ota资源包", + "packageType": 0, + "productIdentification": "3819185904996352", + "version": "1.0.0", + "fileLocation": "509030049229431368", + "status": 0, + "description": "描述", + "customInfo": "\"{\\\"A\\\":1}\"", + "remark": "描述", + "createdOrgId": null + }, + { + "id": "497972960863191072", + "createdTime": "2024-05-25 21:22:24", + "createdBy": "1452186486253289472", + "updatedTime": "2024-06-18 18:19:38", + "updatedBy": "1452186486253289472", + "echoMap": {}, + "appId": "thinglinks-test", + "packageName": "测试ota资源包", + "packageType": 0, + "productIdentification": "3819185904996352", + "version": "1.0.0", + "fileLocation": "509030049229431377", + "status": 0, + "description": "描述", + "customInfo": "\"[{\\\"key\\\":\\\"a\\\",\\\"value\\\":\\\"1\\\",\\\"id\\\":1716643319358},{\\\"key\\\":\\\"b\\\",\\\"value\\\":\\\"2\\\",\\\"id\\\":1716643324273}]\"", + "remark": "描述", + "createdOrgId": null + }, + { + "id": "497972960863191061", + "createdTime": "2024-05-25 14:39:33", + "createdBy": "1452186486253289472", + "updatedTime": "2024-06-14 15:27:09", + "updatedBy": "1452186486253289472", + "echoMap": {}, + "appId": "thinglinks-test", + "packageName": "测试自定义参数3", + "packageType": 0, + "productIdentification": "5880804975194112", + "version": "1.2.0", + "fileLocation": "", + "status": 0, + "description": "111", + "customInfo": "[{\"key\":\"a\",\"value\":\"1\",\"id\":1716619156953}]", + "remark": "7654", + "createdOrgId": null + }, + { + "id": "497972960863191060", + "createdTime": "2024-05-25 14:32:59", + "createdBy": "1452186486253289472", + "updatedTime": "2024-06-14 15:26:51", + "updatedBy": "1452186486253289472", + "echoMap": {}, + "appId": "thinglinks-test", + "packageName": "测试自定义参数2(废弃⚠️)", + "packageType": 0, + "productIdentification": "3819185904996352", + "version": "1.1.0", + "fileLocation": "", + "status": 0, + "description": "测试", + "customInfo": "[{\"key\":\"v\",\"value\":\"123\"}]", + "remark": "11111", + "createdOrgId": null + }, + { + "id": "497972960863191058", + "createdTime": "2024-05-23 23:52:10", + "createdBy": "1452186486253289472", + "updatedTime": "2024-06-14 15:26:45", + "updatedBy": "1452186486253289472", + "echoMap": {}, + "appId": "thinglinks-test", + "packageName": "测试12", + "packageType": 0, + "productIdentification": "4382169500930048", + "version": "1.3.0", + "fileLocation": "", + "status": 0, + "description": "1", + "customInfo": "2", + "remark": "3", + "createdOrgId": null + }, + { + "id": "470808946278400012", + "createdTime": "2024-03-15 09:38:29", + "createdBy": "1452186486253289472", + "updatedTime": "2024-06-14 15:26:42", + "updatedBy": "1452186486253289472", + "echoMap": {}, + "appId": "thinglinks-test", + "packageName": "测试包名1", + "packageType": 0, + "productIdentification": "5880804975194112", + "version": "1.4.0", + "fileLocation": "", + "status": 0, + "description": "", + "customInfo": "[{\"key\":\"a\",\"value\":\"1\",\"id\":1716619156953}]", + "remark": "32323", + "createdOrgId": null + } + ]; \ No newline at end of file diff --git a/thinglinks-ui/vue.config.js b/thinglinks-ui/vue.config.js index b29d553c..d487f1f8 100644 --- a/thinglinks-ui/vue.config.js +++ b/thinglinks-ui/vue.config.js @@ -33,8 +33,8 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://localhost:19100`, - // target: `http://124.223.113.139:19100`, + // target: `http://localhost:19100`, + target: `http://124.223.113.139:19100`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' diff --git a/thinglinks-visual/thinglinks-visual-monitor/Dockerfile b/thinglinks-visual/thinglinks-visual-monitor/Dockerfile index 23bdce89..fd513128 100644 --- a/thinglinks-visual/thinglinks-visual-monitor/Dockerfile +++ b/thinglinks-visual/thinglinks-visual-monitor/Dockerfile @@ -1,5 +1,5 @@ # 使用 Java 运行环境 -FROM openjdk:8-jre +FROM registry.cn-hangzhou.aliyuncs.com/mqttsnet-community/openjdk:17-jdk # 维护者信息 LABEL maintainer="mqttsnet mqttsnet@163.com" @@ -22,4 +22,16 @@ HEALTHCHECK --interval=30s --timeout=30s --retries=3 \ CMD curl -f http://localhost:19400/actuator/health || exit 1 # 启动 Java 应用 -ENTRYPOINT ["java", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] +ENTRYPOINT ["java", \ + "--add-opens=java.base/java.lang=ALL-UNNAMED", \ + "-Xms512m", "-Xmx1024m", \ + "-XX:ReservedCodeCacheSize=256m", \ + "-XX:InitialCodeCacheSize=256m", \ + "-XX:+UnlockExperimentalVMOptions", \ + "-XX:+UseZGC", \ + "-XX:ConcGCThreads=1", "-XX:ParallelGCThreads=2", \ + "-XX:ZCollectionInterval=30", "-XX:ZAllocationSpikeTolerance=5", \ + "-XX:+UnlockDiagnosticVMOptions", "-XX:-ZProactive", \ + "-Dfile.encoding=UTF-8", \ + "-Djava.security.egd=file:/dev/./urandom", \ + "-jar", "/app.jar"] diff --git a/thinglinks-visual/thinglinks-visual-monitor/src/main/resources/bootstrap.yml b/thinglinks-visual/thinglinks-visual-monitor/src/main/resources/bootstrap.yml index 42153478..ad0b78b3 100644 --- a/thinglinks-visual/thinglinks-visual-monitor/src/main/resources/bootstrap.yml +++ b/thinglinks-visual/thinglinks-visual-monitor/src/main/resources/bootstrap.yml @@ -38,7 +38,5 @@ spring: refresh: false - dataId: database.yml refresh: true - - dataId: rocketmq.yml - refresh: false username: @nacos.username@ password: @nacos.password@