物联网-IOT 消息中间件 hiveMQ

物联网已经深深融入我们生活当中,智能家居,智能家电,智慧医疗,智慧城市等通过物联网技术实现了万物互联,大大方便人们生活。当前,我们经历第一代物联网:联网模块+APP;正迈向第二代智能物联网:不仅仅是联网,更需要获取设备运行状态,感知运行环境,可控制管理,智能交互等,而这些,需要核心技术IOT支持,hiveMQ是IOT技术关键消息中间件。hiveMQ 企业版和专业版有强大功能,除了智能设备消息处理,还可提供下面增强功能。

1、HiveMQ Enterprise Extension for Kafka

2、HiveMQ Enterprise Extension for Amazon Kinesis

 3、HiveMQ Enterprise Extension for Google Cloud Pub/Sub

hiveMQ通过MQTT,Http,over Websoket可高效将智能设备链接,下面演示怎么使用hiveMQ对消息操作。

1、安装 hiveMQ CE

docker run --name hivemq-ce -d -p 1883:1883 hivemq/hivemq-ce

2、MacOS 安装mqtt-client

brew install hivemq/mqtt-cli/mqtt-cli

3、Centos 安装mqtt-client

sudo yum install -y https://github.com/hivemq/mqtt-cli/releases/download/v4.15.0/mqtt-cli-4.15.0.rpm

4、测试验证

mqtt test -h 14.*.*.* -p 1883 

MQTT 3: OK

- Maximum topic length: 65535 bytes

- QoS 0: Received 10/10 publishes in 109.54ms

- QoS 1: Received 10/10 publishes in 209.29ms

- QoS 2: Received 10/10 publishes in 304.70ms

- Retain: OK

- Wildcard subscriptions: OK

- Shared subscriptions: OK

- Payload size: >= 100000 bytes

- Maximum client id length: 65535 bytes

- Unsupported Ascii Chars: ALL SUPPORTED

MQTT 5: OK

- Connect restrictions:

                  > Retain: OK

                  > Wildcard subscriptions: OK

                  > Shared subscriptions: OK

                  > Subscription identifiers: OK

                  > Maximum QoS: 2

                  > Receive maximum: 10

                  > Maximum packet size: 268435460 bytes

                  > Topic alias maximum: 5

                  > Session expiry interval: Client-based

                  > Server keep alive: Client-based

mqtt test -h 14.*.*.* -p 1883 -a -V 5 

MQTT 5: OK

- Connect restrictions:

                  > Retain: OK

                  > Wildcard subscriptions: OK

                  > Shared subscriptions: OK

                  > Subscription identifiers: OK

                  > Maximum QoS: 2

                  > Receive maximum: 10

                  > Maximum packet size: 268435460 bytes

                  > Topic alias maximum: 5

                  > Session expiry interval: Client-based

                  > Server keep alive: Client-based - Maximum topic length: 65535 bytes

  - QoS 0: Received 10/10 publishes in 88.96ms

  - QoS 1: Received 10/10 publishes in 92.26ms

  - QoS 2: Received 10/10 publishes in 18.41ms

  - Retain: OK

  - Wildcard subscriptions: OK

  - Shared subscriptions: OK

  - Payload size: >= 100000 bytes

  - Maximum client id length: 65535 bytes

  - Unsupported Ascii Chars: ALL SUPPORTED

5、发布/订阅消息

1)启动sub订阅topic test消息

mqtt sub -t test -h 14.*.*.* -p 1883

Hello

Hello,iot,wellcome

2)启动pub向topic test发布消息

mqtt pub -t test -m "Hello" -h 14.*.*.*5 -p 1883
mqtt pub -t test -m "Hello,iot,wellcome" -h 14.*.*.* -p 1883

3、订阅多个topic消息

mqtt sub -t topic1 -t topic2 -q 2 -h 14.*.*.* -p 1883

4、订阅topic消息,存入到指定文件

mqtt sub -t topic -h 14.*.*.* -p 1883 -of publishes.log 

cat publishes.log

Hello

iot message

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值