diff --git a/manager/src/main/resources/application.yml b/manager/src/main/resources/application.yml index 491d9f7d..1cc9d823 100755 --- a/manager/src/main/resources/application.yml +++ b/manager/src/main/resources/application.yml @@ -8,37 +8,35 @@ spring: max-file-size: 10MB max-request-size: 12MB - #mongodb数据库配置 data: mongodb: - uri: mongodb://填写mongodb地址 + uri: mongodb://iotkit:123456@192.168.100.118:27017/?authSource=iotkit database: iotkit elasticsearch: rest: - #使用内置es的配置 - uris: http://127.0.0.1:9200 - username: - password: + uris: http://192.168.100.118:9200 connection-timeout: 10s redis: - #使用内置redis的配置 - host: 127.0.0.1 + host: 192.168.100.50 port: 6379 database: 0 - password: + password: 5tgbNHY^ + cache: + cache-names: foo,bar + caffeine: + spec: maximumSize=5000,expireAfterAccess=300s mvc: pathmatch: matching-strategy: ant_path_matcher -#图片存储用的是阿里云oss,如果需要上传产品图片才需要配置 aliyun: - bucketId: 填写阿里云bucketId + bucketId: iotkit-images endpoint: oss-cn-shenzhen.aliyuncs.com - accessKeyId: 填写阿里云accessKeyId - accessKeySecret: 填写阿里云accessKeySecret + accessKeyId: LTAI4FmGGouSnScYrGe7rQLA + accessKeySecret: 9S0xjffwmGW2B3HsE4Efw1TqUy8YXC sa-token: # token名称 (同时也是cookie名称) @@ -56,11 +54,23 @@ sa-token: # 是否输出操作日志 is-log: false -#pulsar消息队列配置,需要进行配置 -pulsar: - broker: pulsar://pulsar broker地址:6650 - service: http://pulsar 服务地址:8080 +security: + oauth2: + resource: + filter-order: 3 -#认证中心地址 oauth2: - auth-server-url: http://127.0.0.1:8086 \ No newline at end of file + auth-server-url: http://127.0.0.1:8086 + +pulsar: + broker: pulsar://192.168.100.66:6650 + service: http://192.168.100.66:8080 + +app: + systemRole: iot_system_user + aligenie: + push: + device: +mqtt: + url: tcp:/192.168.100.118:1883 + diff --git a/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxDeviceComponent.java b/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxDeviceComponent.java index 7420eaf8..2d62f846 100755 --- a/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxDeviceComponent.java +++ b/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxDeviceComponent.java @@ -91,25 +91,19 @@ public class EmqxDeviceComponent extends AbstractDeviceComponent { } client = MqttClient.create(vertx, options); - // handler will be called when we have a message in topic we subscribe for - /*client.publishHandler(p -> { - log.info("Client received message on [{}] payload [{}] with QoS [{}]", p.topicName(), p.payload().toString(Charset.defaultCharset()), p.qosLevel()); - });*/ - List topics = mqttConfig.getSubscribeTopics(); Map subscribes = new HashMap<>(); - subscribes.put("/sys/+/+/s/#", 1); + for (String topic : topics) { + subscribes.put(topic, 1); + } + + /*subscribes.put("/sys/+/+/s/#", 1); subscribes.put("/sys/client/connected", 1); subscribes.put("/sys/client/disconnected", 1); subscribes.put("/sys/session/subscribed", 1); - subscribes.put("/sys/session/unsubscribed", 1); + subscribes.put("/sys/session/unsubscribed", 1);*/ - //"/sys/+/+/s/#","/sys/client/disconnected" - - /*for (String topic : topics) { - subscribes.put(topic, 1); - }*/ // handler will be called when we have a message in topic we subscribe for client.publishHandler(p -> { diff --git a/protocol-gateway/emqx-component/src/main/resources/component.js b/protocol-gateway/emqx-component/src/main/resources/component.js index 6d71821f..023ca23f 100644 --- a/protocol-gateway/emqx-component/src/main/resources/component.js +++ b/protocol-gateway/emqx-component/src/main/resources/component.js @@ -1,40 +1,8 @@ !function(n){"use strict";function d(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function f(n,t,r,e,o,u){return d((u=d(d(t,n),d(e,u)))<>>32-o,r)}function l(n,t,r,e,o,u,c){return f(t&r|~t&e,n,t,o,u,c)}function g(n,t,r,e,o,u,c){return f(t&e|r&~e,n,t,o,u,c)}function v(n,t,r,e,o,u,c){return f(t^r^e,n,t,o,u,c)}function m(n,t,r,e,o,u,c){return f(r^(t|~e),n,t,o,u,c)}function c(n,t){var r,e,o,u;n[t>>5]|=128<>>9<<4)]=t;for(var c=1732584193,f=-271733879,i=-1732584194,a=271733878,h=0;h>5]>>>e%32&255);return t}function a(n){var t=[];for(t[(n.length>>2)-1]=void 0,e=0;e>5]|=(255&n.charCodeAt(e/8))<>>4&15)+r.charAt(15&t);return e}function r(n){return unescape(encodeURIComponent(n))}function o(n){return i(c(a(n=r(n)),8*n.length))}function u(n,t){return function(n,t){var r,e=a(n),o=[],u=[];for(o[15]=u[15]=void 0,16 -1 + return JSON.parse(component.getCompMqttClientIdList()).indexOf(clientId) > -1 } function getPkDn(clientId){ @@ -46,9 +14,7 @@ function getPkDn(clientId){ } function auth(head,type,payload){ - var clientIds = component.getCompMqttClientIdList(); if(isServerId(payload.clientid) > -1){ - //throw new Error("dddddd clientIds:" + payload.clientid); return { type:"serverAuth", data:{ @@ -85,7 +51,6 @@ function acl(head,type,payload){ var _topic = payload.topic; if(isServerId(payload.clientid)){ - //throw new Error("dddddd clientIds:" + _topic); return { type: "acl", data:{ @@ -210,33 +175,6 @@ function subRegister(topic,parent, payload){ }; } -/* -function deviceStateChange(head,clientId,state){ - var topic=head.topic; - var device=getPkDn(clientId); - - var arr= topic.split('/'); - if(arr.length<6){ - throw new Error("incorrect topic: "+topic) - } - - var pk=arr[2]; - var dn=arr[3]; - return { - type:"state", - data:{ - productKey:pk, - deviceName:dn, - state:state, - parent:{ - productKey:device.pk, - deviceName:device.dn, - } - } - } -} -*/ - function disconnect(head,type,payload){ var clientId = payload.clientid var device=getPkDn(clientId); @@ -267,7 +205,6 @@ function unsubscribe(head,type,payload){ var topic = payload.topic; if(isServerId(payload.clientid)){ - //throw new Error("dddddd clientIds:" + _topic); return { type: "acl", data:{