mqtt

微服务消息队列(MQTT For IoT)Android Demo使用介绍

▼魔方 西西 提交于 2019-11-30 14:33:07
概述 目前阿里云官方对于微消息队列 MQTT提供了很多语言的参考示例,但是在实际的使用中发现很多用户在使用Android Sample的时候总是会遇到问题,无法正常调试使用。本文主要介绍Android Sample的使用。 具体操作步骤 1、accessKey,secretKey获取参考链接: 阿里云常见参数获取位置 2、serverUri、instanceId参数获取: 3、clientId参数的格式为:GroupId@@@DeviceName,GroupId需要在控制台预创建,DeviceName可以任意设置,确保不要重复即可。 4、Topic获取 具体参数的含义可以参考链接: 微消息队列 MQTT名词解释 5、Demo下载地址: lmq-andriod-demo 6、Android Config文件配置格式参考( 注意: serverUri前面需要加上 tcp://) package mqtt.demo; public class Config { public static final String serverUri = "tcp://post-cn-0pp13ag1111.mqtt.aliyuncs.com"; public static final String clientId = "GID_MQTTDemo@@@********"; public static

MQTT server and MQTT client

。_饼干妹妹 提交于 2019-11-30 14:25:14
1.1 基于linux的多路IO复用,写了一个/poll/select/epoll的mqtt server,纯c实现 https://github.com/jorinzou/MqttServer-and-MqttClient.git 1.2 qt 实现的mqtt client https://github.com/jorinzou/MqttServer-and-MqttClient.git 1.3 更多的mqtt 相关开源链接 一个号称千万级并发连接,百万级消息吞吐,毫秒级消息时延。大规模分布式 mqtt broker,类似一个路由器或者防火墙,通过订阅主题,来转发消息。客户端A订阅了主题X,客户端B也订阅了主题X,A和B都链接了MQTT broker,那么A发布主题x的消息,就会被MQTT broker转发到 B,同理B也是一样。 https://docs.emqx.io/broker/v3/cn/protocol.html 来源: https://my.oschina.net/u/4149215/blog/3111709

python mqtt script on raspberry pi to send and receive messages

∥☆過路亽.° 提交于 2019-11-30 13:31:19
问题 MQTT question: Hi, I’m trying to set up a MQTT network between multiple Raspberry Pis (starting with two). I have one raspberry pi (RPi-A), MQTT client, with a thermistor sensor attached and one raspberry (RPi-B), MQTT broker/client, acting as a hub for my network. Through python scripting I’d like the temperature to be sent every 30mins from RPi-A via MQTT to topic sensor/data and received by RPi-B. When RPi-B receives a message from RPi-A via topic sensor/data, I want it to respond with an

Mosquitto的安装、配置、测试

落爺英雄遲暮 提交于 2019-11-30 09:13:49
Mosquitto是一个开源(BSD许可证)的消息代理,实现MQTT(消息队列遥测传输)协议版本3.1。 MQTT(MQ Telemetry Transport),消息队列遥测传输协议,轻量级的发布/订阅协议,适用于一些条件比较苛刻的环境,进行低带宽、不可靠或间歇性的通信。值得一提的是mqtt提供三种不同质量的消息服务: “至多一次”,消息发布完全依赖底层 TCP/IP 网络。会发生消息丢失或重复。这一级别可用于如下情况,环境传感器数据,丢失一次读记录无所谓,因为不久后还会有第二次发送。 “至少一次”,确保消息到达,但消息重复可能会发生。 “只有一次”,确保消息到达一次。这一级别可用于如下情况,在计费系统中,消息重复或丢失会导致不正确的结果。 方法一:传统源码安装 在Linux系统上安装Mosquitto,本人建议大家使用源码安装模式,最新的源码可从 http://mosquitto.org/files/source/ 地址中获取。解压之后,我们可以在源码目录里面找到主要的配置文件config.mk,其中包含了所有Mosquitto的安装选项,详细的参数说明如下: # 是否支持tcpd/libwrap功能. #WITH_WRAP:=yes # 是否开启SSL/TLS支持 #WITH_TLS:=yes # 是否开启TLS/PSK支持 #WITH_TLS_PSK:=yes #

Mosquitto的安装、配置、测试

拥有回忆 提交于 2019-11-30 09:13:34
Mosquitto是一个开源(BSD许可证)的消息代理,实现MQTT(消息队列遥测传输)协议版本3.1。 MQTT(MQ Telemetry Transport),消息队列遥测传输协议,轻量级的发布/订阅协议,适用于一些条件比较苛刻的环境,进行低带宽、不可靠或间歇性的通信。值得一提的是mqtt提供三种不同质量的消息服务: “至多一次”,消息发布完全依赖底层 TCP/IP 网络。会发生消息丢失或重复。这一级别可用于如下情况,环境传感器数据,丢失一次读记录无所谓,因为不久后还会有第二次发送。 “至少一次”,确保消息到达,但消息重复可能会发生。 “只有一次”,确保消息到达一次。这一级别可用于如下情况,在计费系统中,消息重复或丢失会导致不正确的结果。 方法一:传统源码安装 在Linux系统上安装Mosquitto,本人建议大家使用源码安装模式,最新的源码可从 http://mosquitto.org/files/source/ 地址中获取。解压之后,我们可以在源码目录里面找到主要的配置文件config.mk,其中包含了所有Mosquitto的安装选项,详细的参数说明如下: # 是否支持tcpd/libwrap功能. #WITH_WRAP:=yes # 是否开启SSL/TLS支持 #WITH_TLS:=yes # 是否开启TLS/PSK支持 #WITH_TLS_PSK:=yes #

How to send ping using Eclipse Paho MQTT client?

时光毁灭记忆、已成空白 提交于 2019-11-30 08:51:17
We've just started building our own push notification system (due to client's requirement) for Android and found Eclipse Paho ( http://www.eclipse.org/paho/ ). Needless to say, this project is really exciting. The problem with Android is, if the CPU is in sleep state, the MQTT client may not get the chance to send ping at its set interval. The workaround is using AlarmManager to wake it up and get the job done. The Android documentation says: The Alarm Manager holds a CPU wake lock as long as the alarm receiver's onReceive() method is executing. This guarantees that the phone will not sleep

Cluster forming with Mosquitto broker

廉价感情. 提交于 2019-11-30 08:31:39
问题 I am using Mosquitto broker to implement MQTT protocol. But I am unable to find how clustering can be done in case of mosquitto brokers. Also is there any limitation on number of clients those can be served with one broker. 回答1: You can't do clustering with mosquitto. Some other MQTT brokers out there which support clustering, including HiveMQ. HiveMQ has an elastic cluster ability with auto discovery and a distributed masterless architecture and works very well on cloud providers like AWS or

SparkStreaming, RabbitMQ and MQTT in python using pika

回眸只為那壹抹淺笑 提交于 2019-11-30 08:29:12
Just to make things tricky, I'd like to consume messages from the rabbitMQ queue. Now I know there is a plugin for MQTT on rabbit ( https://www.rabbitmq.com/mqtt.html ). However I cannot seem to make an example work where Spark consumes a message that has been produced from pika. For example I am using the simple wordcount.py program here ( https://spark.apache.org/docs/1.2.0/streaming-programming-guide.html ) to see if I can I see a message producer in the following way: import sys import pika import json import future import pprofile def sendJson(json): connection = pika.BlockingConnection

python mqtt script on raspberry pi to send and receive messages

房东的猫 提交于 2019-11-30 07:34:36
MQTT question: Hi, I’m trying to set up a MQTT network between multiple Raspberry Pis (starting with two). I have one raspberry pi (RPi-A), MQTT client, with a thermistor sensor attached and one raspberry (RPi-B), MQTT broker/client, acting as a hub for my network. Through python scripting I’d like the temperature to be sent every 30mins from RPi-A via MQTT to topic sensor/data and received by RPi-B. When RPi-B receives a message from RPi-A via topic sensor/data, I want it to respond with an instruction via MQTT topic sensor/instructions to RPi-A. Below is my script, so far RPi-A can send

What is the use/purpose of MQTT QoS?

痞子三分冷 提交于 2019-11-30 07:22:14
I am studying the MQTT protocol and it seems that there is a contradiction in the very first lines of the specs: The protocol runs over TCP/IP, or over other network protocols that provide ordered, lossless , bi-directional connections. Its features include: [...] Three qualities of service for message delivery: "At most once", where messages are delivered according to the best efforts of the operating environment. Message loss can occur . This level could be used, for example, with ambient sensor data where it does not matter if an individual reading is lost as the next one will be published