mqtt

Elastic: 把MQTT数据传入到Elasticsearch

孤者浪人 提交于 2020-01-14 08:55:37
Elasticsearch 可以存储PB级的数据并实时分析数据,而 MQTT 被广泛使用于物联网中。那么我们该如果把MQTT的数据传入到Elasticsearch中呢? 我们可以通过如下的架构来把MQTT数据传入到Elasticsearch: 在这里,我们可以通过一个叫做MQTT的router来把数据传入到Elasticsearch。这些物联网的数据可以包括温度,速度,位置,速度,湿度,重力加速度,光感等。 下面,我们来介绍一下如何实现把MQTT的数据接入到Elasticsearch中来。为了说明问题方便,我们的测试环境是这样的: 如上图所示,我们在MacOS上安装好自己的Elastic Stack。在Ubuntu 18.04的机器上安装好自己的MQTT broker及运行MQTT的publisher。 准备工作 安装Elasticsearch 如果大家还没安装好自己的Elastic Stack的话,那么请按照我之前的教程“ 如何在Linux,MacOS及Windows上进行安装Elasticsearch ” 安装好自己的Elasticsearch。由于我们的Elastic Stack需要被另外一个Ubuntu VM来访问,我们需要对我们的Elasticsearch进行配置。首先使用一个编辑器打开在config目录下的elasticsearch.yml配置文件

How to publish a message while receiving on a Java MQTT client using Eclipse Paho

喜欢而已 提交于 2020-01-14 08:14:41
问题 I'm trying to implement some features on an MQTT client in Java with Eclipse Paho. The target is to subscribe to a topic and when a message is received, the client send another message on another topic. This looks very easy, but I have a weird problem I can't solve. Here is my code : import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; import org.eclipse.paho.client.mqttv3.IMqttToken; import org.eclipse.paho.client.mqttv3.MqttCallback; import org.eclipse.paho.client.mqttv3

How to publish a message while receiving on a Java MQTT client using Eclipse Paho

不想你离开。 提交于 2020-01-14 08:12:20
问题 I'm trying to implement some features on an MQTT client in Java with Eclipse Paho. The target is to subscribe to a topic and when a message is received, the client send another message on another topic. This looks very easy, but I have a weird problem I can't solve. Here is my code : import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; import org.eclipse.paho.client.mqttv3.IMqttToken; import org.eclipse.paho.client.mqttv3.MqttCallback; import org.eclipse.paho.client.mqttv3

java连接MQTT服务器

风格不统一 提交于 2020-01-13 23:39:28
目录 一、业务场景 二、本文只讲解java连接MQTT服务器进行数据处理 一、业务场景 硬件采集的数据传入EMQX平台(采用MQTT协议),java通过代码连接MQTT服务器,进行采集数据接收、解析、业务处理、存储入库、数据展示。 MQTT 是基于 发布(Publish)/订阅(Subscribe) 模式来进行通信及数据交换的。 二、本文只讲解java连接MQTT服务器进行数据处理 1、新建springboot项目,pom文件中直接引入下面的mqtt依赖 <dependency> <groupId>org.springframework.integration</groupId> <artifactId>spring-integration-mqtt</artifactId> </dependency> 2、 编写MQTT工具类 package com.siborui.dc.mqtt; import lombok.extern.slf4j.Slf4j; import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import org.springframework.beans.factory.annotation.Value;

万物互联—MQTT协议

混江龙づ霸主 提交于 2020-01-11 16:50:00
一、简介 MQTT(Message Queuing Telemetry Transport,消息队列遥测传输),最早是1999年由IBM开发的基于发布/订阅范式的消息协议,是一种极其简单和轻量级的消息协议,专为受限设备和低带宽、高延迟或不可靠的网络设计。 自1999年以来, 已在多个行业广泛实施,是一种物联网和移动互联网领域的行业标准协议,适合移动终端之间的数据传输,用于端与云之间的消息传递,实现真正意义上的万物互联。 二、应用场景 由于MQTT 版的多协议、多语言和多平台的支持能力的特性,使其目前广泛应用于机器与机器(M2M)通信和物联网(IoT)领域,覆盖了车联网、智能餐饮、即时聊天、智能家居、医疗设备、物流等多种应用场景。 三、协议特性 发布/订阅范式消息模式,提供一对多的消息发布; 使用 TCP/IP 提供网络连接,实现有序的、可靠的、双向字节流传输; 小型传输,开销很小(固定长度的头部是 2 字节),协议交换最小化,以降低网络流量; 使用 Last Will(遗言机制) 和 Testament (遗嘱机制)通知有关各方客户端异常中断的机制; 消息服务质量(QoS)支持,可靠传输保证,三种消息发布服务质量(QoS): 分类 描述 QoS0:至多一次 消息发布完全依赖底层 TCP/IP 网络。会发生消息丢失或重复。这一级别可用于如下情况,环境传感器数据,丢失一次读记录无所谓

mqtt client gets disconnected frequently when running on multiple threads

旧街凉风 提交于 2020-01-11 13:47:14
问题 I have mosca mqtt broker runnning. I connect to it using paho-mqtt from a python client. I have two threads which I run parallely in my code, one to receive messages and the other to publish. def SendCommand(rpm,valve_opening): control_packet = { ######## } print(control_packet) print('sending command') # client.publish("cmd",control_packet) def on_connect(client, userdata, flags, rc): if rc==0: print("connected OK Returned code=",rc) client.subscribe('data/#') else: print("Bad connection

Mosquitto 1.4.2 Websocket support

Deadly 提交于 2020-01-11 06:49:08
问题 I'm trying to utilize Mosquittos recent update to support websockets in the broker. I'm running Mosquitto v1.4.2 and I've added the following lines to the mosquitto configuration file (mosquitto.conf): listener 10001 127.0.0.1 protocol websockets listener 1883 protocol mqtt When I try and start the broker with the new configuration I get the following : $ mosquitto -c /etc/mosquitto/mosquitto.conf Error: Websockets support not available. Error found at /etc/mosquitto/mosquitto.conf:16. Error:

How to send ping using Eclipse Paho MQTT client?

喜欢而已 提交于 2020-01-10 14:12:07
问题 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

物联网MQTT 协议测试

谁说胖子不能爱 提交于 2020-01-10 05:36:40
MQTT测试 MQTT是一个客户端服务端架构的发布/订阅模式的消息传输协议。 它的设计思想是轻巧、开放、简单、规范,易于实现。 这些特点使得它对很多场景来说都是很好的选择,特别是对于受限的环境如机器与机器的通信(M2M)以及物联网环境(IoT)。 MQTT 服务器有多种,其中功能比较齐全的推荐有mosquitto,emqttd,Apache Apollo。其中安装mosquito过程中windows 存在各种异常,最后未搭建成功,改为选择emqttd 方式。 EMQTT 服务器搭建 1. 下载windows安装源页面 http://emqtt.com/downloads 2. 下载完成后解压,进入目录 \emqttd\bin 3. 分别命令执行,启动MQTT服务器 emqttd console emqttd install emqttd start 4. 启动浏览器访问网页 特别说明,在执行命令后,注意防火墙选择允许访问方式。三条命令运行完成后,会自动处于运行状态。保持当前窗口,然后启动浏览器访问 http://127.0.0.1:18083 (默认账户用户名:admin,密码public)服务器地址可修改,默认为本地回环ip地址127.0.0.1 客户端工具配置 客户端工具较多,下文主要介绍windows常见的MQTT.FX 和MQTTBox两种客户端,使用过程中二选一即可。

MQTT-emqx,activemq

让人想犯罪 __ 提交于 2020-01-09 17:28:37
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一,win10下安装EMQ 1,下载解压(链接 https://www.emqx.io/downloads ) 2,将压缩包放在D,F根目录下进行解压,进入bin下, 执行emqx start, emqx.status, emqx stop, emqx uninstall; 3,浏览器地址 http://127.0.0.1:18083 , 用户名密码admin/public 来源: oschina 链接: https://my.oschina.net/u/3290532/blog/3155439