diff --git a/pom.xml b/pom.xml index 528769bc9..c64337f34 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,8 @@ yudao-module-system yudao-module-infra - + yudao-module-iot + diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index badfc84f9..07d144f53 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -64,6 +64,7 @@ 2.9.2 2.7.0 3.0.6 + 1.2.5 3.5.0 4.11.0 @@ -621,6 +622,13 @@ ${xercesImpl.version} + + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + ${mqtt.version} + + diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java index d60473a48..c8b0dbd66 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java @@ -62,6 +62,10 @@ public class BannerApplicationRunner implements ApplicationRunner { if (isNotPresent("cn.iocoder.yudao.module.ai.framework.web.config.AiWebConfiguration")) { System.out.println("[AI 大模型 yudao-module-ai - 已禁用][参考 https://doc.iocoder.cn/ai/build/ 开启]"); } + // IOT 物联网 + if (isNotPresent("cn.iocoder.yudao.module.iot.framework.web.config.IotWebConfiguration")) { + System.out.println("[IOT 物联网 yudao-module-iot - 已禁用][参考 https://doc.iocoder.cn/iot/build/ 开启]"); + } }); } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java index 3b0a17fa4..39f2ff87f 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java @@ -360,6 +360,12 @@ public class GlobalExceptionHandler { return CommonResult.error(NOT_IMPLEMENTED.getCode(), "[AI 大模型 yudao-module-ai - 表结构未导入][参考 https://doc.iocoder.cn/ai/build/ 开启]"); } + // 9. IOT 物联网 + if (message.contains("iot_")) { + log.error("[IOT 物联网 yudao-module-iot - 表结构未导入][参考 https://doc.iocoder.cn/iot/build/ 开启]"); + return CommonResult.error(NOT_IMPLEMENTED.getCode(), + "[IOT 物联网 yudao-module-iot - 表结构未导入][参考 https://doc.iocoder.cn/iot/build/ 开启]"); + } return null; } diff --git a/yudao-module-iot/pom.xml b/yudao-module-iot/pom.xml new file mode 100644 index 000000000..96f8d181f --- /dev/null +++ b/yudao-module-iot/pom.xml @@ -0,0 +1,24 @@ + + + + yudao + cn.iocoder.boot + ${revision} + + + yudao-module-iot-api + yudao-module-iot-biz + + 4.0.0 + + yudao-module-iot + pom + + ${project.artifactId} + + 物联网模块 + + + \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-api/pom.xml b/yudao-module-iot/yudao-module-iot-api/pom.xml new file mode 100644 index 000000000..8a75b09bf --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-api/pom.xml @@ -0,0 +1,26 @@ + + + + yudao-module-iot + cn.iocoder.boot + ${revision} + + 4.0.0 + yudao-module-iot-api + jar + + ${project.artifactId} + + 物联网 模块 API,暴露给其它模块调用 + + + + + cn.iocoder.boot + yudao-common + + + + diff --git a/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/package-info.java b/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/package-info.java new file mode 100644 index 000000000..65d049636 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/package-info.java @@ -0,0 +1,4 @@ +/** + * iot API 包,定义暴露给其它模块的 API + */ +package cn.iocoder.yudao.module.iot.api; diff --git a/yudao-module-iot/yudao-module-iot-biz/pom.xml b/yudao-module-iot/yudao-module-iot-biz/pom.xml new file mode 100644 index 000000000..4615bce9f --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/pom.xml @@ -0,0 +1,57 @@ + + + + yudao-module-iot + cn.iocoder.boot + ${revision} + + 4.0.0 + jar + + yudao-module-iot-biz + + ${project.artifactId} + + 物联网 模块,主要实现 产品管理、设备管理、协议管理等功能。 + + + + + cn.iocoder.boot + yudao-module-iot-api + ${revision} + + + + + cn.iocoder.boot + yudao-spring-boot-starter-web + + + + cn.iocoder.boot + yudao-spring-boot-starter-security + + + + + cn.iocoder.boot + yudao-spring-boot-starter-mybatis + + + + + cn.iocoder.boot + yudao-spring-boot-starter-test + + + + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + + + + diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/package-info.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/package-info.java new file mode 100644 index 000000000..5d2990e1b --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/package-info.java @@ -0,0 +1,6 @@ +/** + * 提供 RESTful API 给前端: + * 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目 + * 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分 + */ +package cn.iocoder.yudao.module.iot.controller; diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/callback/EmqxCallback.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/callback/EmqxCallback.java new file mode 100644 index 000000000..a34863a17 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/callback/EmqxCallback.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.iot.emq.callback; + +import cn.iocoder.yudao.module.iot.emq.client.EmqxClient; +import cn.iocoder.yudao.module.iot.emq.service.EmqxService; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; +import org.eclipse.paho.client.mqttv3.MqttCallbackExtended; +import org.eclipse.paho.client.mqttv3.MqttMessage; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; + +/** + * 用于处理MQTT连接的回调,如连接断开、消息到达、消息发布完成、连接完成等事件。 + * + * @author ahh + */ +@Slf4j +@Component +public class EmqxCallback implements MqttCallbackExtended { + + @Lazy + @Resource + private EmqxService emqxService; + + @Lazy + @Resource + private EmqxClient emqxClient; + + @Override + public void connectionLost(Throwable throwable) { + log.info("MQTT 连接断开", throwable); + } + + @Override + public void messageArrived(String topic, MqttMessage mqttMessage) { + emqxService.subscribeCallback(topic, mqttMessage); + } + + @Override + public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { + log.info("消息发送成功: {}", iMqttDeliveryToken.getMessageId()); + } + + @Override + public void connectComplete(boolean reconnect, String serverURI) { + log.info("MQTT 已连接到服务器: {}", serverURI); + emqxService.subscribe(emqxClient.getMqttClient()); + } +} + + + diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/client/EmqxClient.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/client/EmqxClient.java new file mode 100644 index 000000000..461a748d2 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/client/EmqxClient.java @@ -0,0 +1,86 @@ +package cn.iocoder.yudao.module.iot.emq.client; + +import cn.iocoder.yudao.module.iot.emq.callback.EmqxCallback; +import cn.iocoder.yudao.module.iot.emq.config.MqttConfig; +import jakarta.annotation.Resource; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.eclipse.paho.client.mqttv3.MqttClient; +import org.eclipse.paho.client.mqttv3.MqttConnectOptions; +import org.eclipse.paho.client.mqttv3.MqttException; +import org.eclipse.paho.client.mqttv3.MqttMessage; +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; +import org.springframework.stereotype.Component; + +/** + * MQTT客户端类,负责建立与MQTT服务器的连接,提供发布消息和订阅主题的功能 + * + * @author ahh + */ +@Slf4j +@Data +@Component +public class EmqxClient { + + @Resource + private EmqxCallback emqxCallback; + @Resource + private MqttConfig mqttConfig; + + private MqttClient mqttClient; + + public void connect() { + if (mqttClient == null) { + createMqttClient(); + } + try { + mqttClient.connect(createMqttOptions()); + log.info("MQTT客户端连接成功"); + } catch (MqttException e) { + log.error("MQTT客户端连接失败", e); + } + } + + private void createMqttClient() { + try { + mqttClient = new MqttClient(mqttConfig.getHostUrl(), "yudao-" + mqttConfig.getClientId(), new MemoryPersistence()); + mqttClient.setCallback(emqxCallback); + } catch (MqttException e) { + log.error("创建MQTT客户端失败", e); + } + } + + private MqttConnectOptions createMqttOptions() { + MqttConnectOptions options = new MqttConnectOptions(); + options.setUserName(mqttConfig.getUsername()); + options.setPassword(mqttConfig.getPassword().toCharArray()); + options.setConnectionTimeout(mqttConfig.getTimeout()); + options.setKeepAliveInterval(mqttConfig.getKeepalive()); + options.setCleanSession(mqttConfig.isClearSession()); + return options; + } + + public void publish(String topic, String message) { + try { + if (mqttClient == null || !mqttClient.isConnected()) { + connect(); + } + mqttClient.publish(topic, new MqttMessage(message.getBytes())); + log.info("消息已发布到主题: {}", topic); + } catch (MqttException e) { + log.error("消息发布失败", e); + } + } + + public void subscribe(String topic) { + try { + if (mqttClient == null || !mqttClient.isConnected()) { + connect(); + } + mqttClient.subscribe(topic); + log.info("订阅了主题: {}", topic); + } catch (MqttException e) { + log.error("订阅主题失败", e); + } + } +} \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/config/MqttConfig.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/config/MqttConfig.java new file mode 100644 index 000000000..ae1557c23 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/config/MqttConfig.java @@ -0,0 +1,66 @@ +package cn.iocoder.yudao.module.iot.emq.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 配置类,用于读取MQTT连接的配置信息,如用户名、密码、连接地址等 + * + * @author ahh + */ +@Data +@Component +@ConfigurationProperties("iot.emq") +public class MqttConfig { + + /** + * 用户名 + */ + private String username; + /** + * 密码 + */ + private String password; + + /** + * 连接地址 + */ + private String hostUrl; + + /** + * 客户Id + */ + private String clientId; + + /** + * 默认连接话题 + */ + private String defaultTopic; + + /** + * 超时时间 + */ + private int timeout; + + /** + * 保持连接数 + */ + private int keepalive; + + /** + * 是否清除session + */ + private boolean clearSession; + + /** + * 是否共享订阅 + */ + private boolean isShared; + + /** + * 分组共享订阅 + */ + private boolean isSharedGroup; + +} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/service/EmqxService.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/service/EmqxService.java new file mode 100644 index 000000000..b323d929c --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/service/EmqxService.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.iot.emq.service; + +import lombok.extern.slf4j.Slf4j; +import org.eclipse.paho.client.mqttv3.MqttClient; +import org.eclipse.paho.client.mqttv3.MqttMessage; +import org.springframework.stereotype.Service; + +/** + * 用于处理MQTT消息的具体业务逻辑,如订阅回调 + * + * @author ahh + */ +@Slf4j +@Service +public class EmqxService { + + public void subscribeCallback(String topic, MqttMessage mqttMessage) { + log.info("收到消息,主题: {}, 内容: {}", topic, new String(mqttMessage.getPayload())); + // 根据不同的主题,处理不同的业务逻辑 + if (topic.contains("/property/post")) { + // 设备上报数据 + } + } + + public void subscribe(MqttClient client) { + try { + // 订阅默认主题,可以根据需要修改 + client.subscribe("$share/yudao/+/+/#", 1); + log.info("订阅默认主题成功"); + } catch (Exception e) { + log.error("订阅默认主题失败", e); + } + } +} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/start/EmqxStart.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/start/EmqxStart.java new file mode 100644 index 000000000..f954cb588 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/emq/start/EmqxStart.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.iot.emq.start; + +import cn.iocoder.yudao.module.iot.emq.client.EmqxClient; +import jakarta.annotation.Resource; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +/** + * 用于在应用启动时自动连接MQTT服务器 + * + * @author ahh + */ +@Component +public class EmqxStart implements ApplicationRunner { + + @Resource + private EmqxClient emqxClient; + + @Override + public void run(ApplicationArguments applicationArguments) { + emqxClient.connect(); + } +} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/package-info.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/package-info.java new file mode 100644 index 000000000..9d8ffe73d --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/package-info.java @@ -0,0 +1,6 @@ +/** + * 属于 iot 模块的 framework 封装 + * + * @author 芋道源码 + */ +package cn.iocoder.yudao.module.iot.framework; diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/web/config/IotWebConfiguration.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/web/config/IotWebConfiguration.java new file mode 100644 index 000000000..890e60c7c --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/web/config/IotWebConfiguration.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.iot.framework.web.config; + +import cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration; +import org.springdoc.core.models.GroupedOpenApi; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * iot 模块的 web 组件的 Configuration + * + * @author 芋道源码 + */ +@Configuration(proxyBeanMethods = false) +public class IotWebConfiguration { + + /** + * iot 模块的 API 分组 + */ + @Bean + public GroupedOpenApi iotGroupedOpenApi() { + return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("iot"); + } + +} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/web/package-info.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/web/package-info.java new file mode 100644 index 000000000..aafcca274 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/web/package-info.java @@ -0,0 +1,4 @@ +/** + * iot 模块的 web 拓展封装 + */ +package cn.iocoder.yudao.module.iot.framework.web; diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml index 3b16fa192..6ed31f148 100644 --- a/yudao-server/pom.xml +++ b/yudao-server/pom.xml @@ -1,6 +1,6 @@ - cn.iocoder.boot @@ -33,80 +33,87 @@ - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + + + + + cn.iocoder.boot + yudao-module-iot-biz + ${revision} + diff --git a/yudao-server/src/main/java/cn/iocoder/yudao/server/controller/DefaultController.java b/yudao-server/src/main/java/cn/iocoder/yudao/server/controller/DefaultController.java index 3f4bae04f..2bf6e5277 100644 --- a/yudao-server/src/main/java/cn/iocoder/yudao/server/controller/DefaultController.java +++ b/yudao-server/src/main/java/cn/iocoder/yudao/server/controller/DefaultController.java @@ -65,4 +65,10 @@ public class DefaultController { "[AI 大模型 yudao-module-ai - 已禁用][参考 https://doc.iocoder.cn/ai/build/ 开启]"); } + @RequestMapping(value = {"/admin-api/iot/**"}) + public CommonResult iot404() { + return CommonResult.error(NOT_IMPLEMENTED.getCode(), + "[IOT 物联网 yudao-module-iot - 已禁用][参考 https://doc.iocoder.cn/iot/build/ 开启]"); + } + } diff --git a/yudao-server/src/main/resources/application-dev.yaml b/yudao-server/src/main/resources/application-dev.yaml index 46399b802..3e7f4e76a 100644 --- a/yudao-server/src/main/resources/application-dev.yaml +++ b/yudao-server/src/main/resources/application-dev.yaml @@ -193,4 +193,23 @@ justauth: cache: type: REDIS prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: - timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 \ No newline at end of file + timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 + + +--- #################### iot相关配置 #################### +iot: + emq: + # 账号 + username: anhaohao + # 密码 + password: ahh@123456 + # 主机地址 + hostUrl: tcp://chaojiniu.top:1883 + # 客户端Id,不能相同,采用随机数 ${random.value} + client-id: ${random.int} + # 默认主题 + default-topic: test + # 保持连接 + keepalive: 60 + # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息) + clearSession: true \ No newline at end of file diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 935ca8064..20110708c 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -45,7 +45,7 @@ spring: primary: master datasource: master: - url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://127.0.0.1:3307/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -54,7 +54,7 @@ spring: # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例 username: root - password: 123456 + password: ahh@123456 # username: sa # SQL Server 连接的示例 # password: Yudao@2024 # SQL Server 连接的示例 # username: SYSDBA # DM 连接的示例 @@ -63,9 +63,9 @@ spring: # password: Yudao@2024 # OpenGauss 连接的示例 slave: # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true + url: jdbc:mysql://127.0.0.1:3307/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true username: root - password: 123456 + password: ahh@123456 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 data: @@ -249,3 +249,20 @@ justauth: prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 +--- #################### iot相关配置 #################### +iot: + emq: + # 账号 + username: anhaohao + # 密码 + password: ahh@123456 + # 主机地址 + hostUrl: tcp://chaojiniu.top:1883 + # 客户端Id,不能相同,采用随机数 ${random.value} + client-id: ${random.int} + # 默认主题 + default-topic: test + # 保持连接 + keepalive: 60 + # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息) + clearSession: true \ No newline at end of file