소스 검색

新增alibaba iot 数据订阅功能

wwd 3 년 전
부모
커밋
9c41d885e1

+ 9 - 1
README.md

@@ -1,7 +1,15 @@
 # ztk-encryptdacodedata
 
+## **概述**
+
 招商地产的项目
 本项目实现 Edge侧和Cloud云端数据传输过程的通道加密和数据加密,通道使用ssl证书加密,数据实现RSA公钥私钥加密解密过程,该项目在部署过程中不建议暴露配置文件,因为密钥在配置文件中,方便进行运维部署,
 dev环境
 请参照配置文件,在Edge侧部署,则将配置文件location 位置设置成Edge,云端部署则部署成Cloud,请注意大小写,dev配置文件中公钥私钥,均为开发使用,UAT环境和prod环境请另换密钥,kafka集群环境在dev环境中无配置。
-云边服务器端口请按现有格式进行对应添加,如有问题请联系wangwendong@persagy.com
+云边服务器端口请按现有格式进行对应添加,如有问题请联系wangwendong@persagy.com
+
+2021年7月23日更新
+新增从阿里iot订阅消息的功能
+
+集成阿里云Iot实现数据订阅,入门文档见
+https://help.aliyun.com/document_detail/189346.html

+ 34 - 3
pom.xml

@@ -115,6 +115,24 @@
             <artifactId>commons-lang3</artifactId>
             <version>3.7</version>
         </dependency>
+        <dependency>
+            <groupId>com.aliyun.alink.linksdk</groupId>
+            <artifactId>iot-linkkit-java</artifactId>
+            <version>1.2.0.1</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun.alink.linksdk</groupId>
+            <artifactId>public-cmp-java</artifactId>
+            <version>1.3.6</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.1</version>
+            <scope>compile</scope>
+        </dependency>
         <!-- https://mvnrepository.com/artifact/cn.shuibo/rsa-encrypt-body-spring-boot -->
         <dependency>
             <groupId>cn.shuibo</groupId>
@@ -137,6 +155,19 @@
             <artifactId>netty-all</artifactId>
             <version>4.1.43.Final</version>
         </dependency>
+        <!-- amqp 1.0 qpid client -->
+        <dependency>
+            <groupId>org.apache.qpid</groupId>
+            <artifactId>qpid-jms-client</artifactId>
+            <version>0.56.0</version>
+        </dependency>
+
+        <!-- util for base64-->
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.10</version>
+        </dependency>
     </dependencies>
 
     <build>
@@ -161,9 +192,9 @@
     </build>
     <repositories>
         <repository>
-            <id>spring-milestones</id>
-            <name>Spring Milestones</name>
-            <url>https://repo1.maven.org/maven2/</url>
+            <id>alimaven</id>
+            <name>aliyun maven</name>
+            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
         </repository>
         <repository>
             <id>spring-snapshots</id>

+ 2 - 1
src/main/java/com/persagy/ztkencryptdecodedata/ZtkEncryptdecodedataApplication.java

@@ -7,8 +7,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.ServletComponentScan;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.PropertySource;
+import org.springframework.scheduling.annotation.EnableAsync;
 
-
+@EnableAsync
 @EnableSecurity
 @PropertySource(value = "classpath:application-${spring.profiles.active}.yml", encoding = "UTF-8",factory = YmlPropertySourceFactory.class)
 @ServletComponentScan

+ 13 - 0
src/main/resources/application-dev.yml

@@ -30,4 +30,17 @@ spring:
       fetch-max-wait: 500
       enable-auto-commit: true
       max-poll-records: 1000
+alibaba:
+  iot:
+    accessKey: "LTAI4G17bcrwA5wexPRNAbNw"
+    accessSecret: "LpbFTkw09VxAYFIDw9fvkwES6Lkz2i"
+    consumerGroupId: "DEFAULT_GROUP"
+    iotInstanceId: ""
+    clientId: "xlink-ali-iot"
+    host: "291842004283785446.iot-amqp.cn-shanghai.aliyuncs.com"
+
+
+
+
+
 

+ 8 - 0
src/main/resources/application-prod.yml

@@ -31,3 +31,11 @@ spring:
       enable-auto-commit: true
       max-poll-records: 1000
 
+alibaba:
+  iot:
+    accessKey: "LTAI4G17bcrwA5wexPRNAbNw"
+    accessSecret: "LpbFTkw09VxAYFIDw9fvkwES6Lkz2i"
+    consumerGroupId: "DEFAULT_GROUP"
+    iotInstanceId: ""
+    clientId: "xlink-ali-iot"
+    host: "291842004283785446.iot-amqp.cn-shanghai.aliyuncs.com"

+ 8 - 0
src/main/resources/application-uat.yml

@@ -31,3 +31,11 @@ spring:
       enable-auto-commit: true
       max-poll-records: 1000
 
+alibaba:
+  iot:
+    accessKey: "LTAI4G17bcrwA5wexPRNAbNw"
+    accessSecret: "LpbFTkw09VxAYFIDw9fvkwES6Lkz2i"
+    consumerGroupId: "DEFAULT_GROUP"
+    iotInstanceId: ""
+    clientId: "xlink-ali-iot"
+    host: "291842004283785446.iot-amqp.cn-shanghai.aliyuncs.com"

+ 1 - 1
src/main/resources/application.yml

@@ -1,7 +1,7 @@
 spring:
   profiles:
     active: dev
-  location: Edge  # Edge 边缘测 or Cloud 云端
+  location: Cloud  # Edge 边缘测 or Cloud 云端