微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

iot-mqtt-bridge 描述文件与 mqtt 的消息中间件

程序名称:iot-mqtt-bridge

授权协议: Apache

操作系统: 未知

开发语言:

iot-mqtt-bridge 介绍

iot-mqtt-bridge

feature:

  • [x] 解析简单 mqtt 消息存到 MysqL
  • [ ] 解析简单 mqtt 消息存到 kafka
  • [ ] 解析复杂消息
  • [ ] 批处理存储数据
  • [ ] 自定义各种 handler

你只需要在 model.json 里定义一个描述文件,具体以含义看注释,

然后配置 mqtt ,MysqL 连接信息在 bridge.yml,

运行 release/bin/server 启动项目

就可以自动根据描述文件解析mqtt消息并存进数据库内。

[
  {
    "name": "user", //"动态生成的类名”
    "topic": "user_topic",
    "clientId": "user_client",
    "cleanSession": true,
    "qos": 1,
    "storeType": "MysqL",
    "fields": [{
        "name": "id",
        "type": "long", //"存数据库字段的类型"
        "index": 1,
        "lenght": 8, //"截取多少个字节"
        "offset": 2,
        "idType": "auto" //”如果是auto就是用数据库的自增,否则是截取到的数据“
    },
    {
        "name": "loginLength",
        "type": "int",
        "index": 2,
        "lenght": 2,
        "isTransient": true //"不持久化到数据库内"
    },
    {
        "name": "login",
        "type": "byte[]",
        "index": 3,
        "dependsOn": 2 //"根据指定index的字段的值作为长度“
    }

]



spring:
  datasource:
    driver-class-name: com.MysqL.jdbc.Driver
    url: jdbc:MysqL://localhost:3306/mqtt_test
    username:
    password:
jdbc:
  template:
    prefix: t_
    suffix: _test
    insertGetId: false   
logging:
  config: logback.xml
bridge:
  modelPath: model.json
  mqtts:
    - url: tcp://localhost:1883
      username:
      password:
      keepAlive: 20
      retained: false
      reconnectAttemptsMax: -1
      reconnectDelay: 10
      models:
        - user

iot-mqtt-bridge 官网

https://github.com/ShiCloud/iot-mqtt-bridge

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐