mqtt

关于spring boot集成MQTT

↘锁芯ラ 提交于 2019-12-04 07:58:36
安装 说到mqtt,首先肯定要安装了,安装什么的地址: http://activemq.apache.org/ap... 我本地是Windows的环境,所以装的是Windows版本,这里是第一个注意的地方,因为后面使用的时候windows和linux的有一些不同 下载完成之后就是解压安装了,这里解压完成之后进入bin目录下,自己用cmd或者直接进去在此处打开命令窗口也行,然后运行apollo.cmd 创建一个服务实例我的实例名称是mybroker所以命令是 apollo.cmd create mybroker,这个名称自己可以随便指定 创建完实例后发现bin 目录下多了一个文件夹,这个文件夹就是你实例名称,进入文件夹运行 .apollo-broker.cmd run 命令 这样就启动成功了 启动成功可以去 http://localhost :61680/console/index.html看看,登录账号和密码在mybrokeretcusers.properties文件中找到输入就可以进去了 页面上有连接信息和订阅主题的一些对应信息,有兴趣的自己看下,后面也会讲到的 使用 安装成功接下来就是使用了,首先创建一个maven工程,引入配置 <!--mqtt--> <dependency> <groupId>org.springframework.boot</groupId>

Send LoRa measures to Fiware IOT agent via MQTT

北慕城南 提交于 2019-12-04 07:05:42
问题 I have LoRa sensors which send measures with Cayenne LPP format payload. My Gateway(LOrank8v1) catches these packets and converts them to UDP. In the gateway there is a service(lora-gateway-bridge) which converts the packets from UDP to TCP/MQTT. Then the MQTT packets are published to the mosquitto MQTT broker in the cloud. Then i run lora-server and lora-app-server services in order to decrypt,decode and deduplicate the packets. Then i publish the decrypted information to the MQTT broker

MQTT 5.0 协议介绍 - 共享订阅

情到浓时终转凉″ 提交于 2019-12-04 06:43:38
前言 共享订阅是 MQTT 5.0 协议引入的新特性,相当于是订阅端的负载均衡功能。 我们知道一般的非共享订阅的消息发布流程是这样的: 在这种结构下,如果订阅节点发生故障,就会导致发布者的消息丢失(QoS 0)或者堆积在 Server 中(QoS 1, 2)。一般情况下,解决这个问题的办法都是直接增加订阅节点,但这样又产生了大量的重复消息,不仅浪费性能,在某些业务场景下,订阅节点还需要自行去重,进一步增加了业务的复杂度。 其次,当发布者的生产能力较强时,可能会出现订阅者的消费能力无法及时跟上的情况,此时只能由订阅者自行实现负载均衡来解决,又一次增加了用户的开发成本。 协议规范 现在,在 MQTT 5.0 协议中,你可以通过共享订阅特性解决上面提到的问题。当你使用共享订阅时,消息的流向就会变为: 同非共享订阅一样,共享订阅包含一个主题过滤器和订阅选项,唯一的区别在于共享订阅的主题过滤器格式必须是 $share/{ShareName}/{filter} 这种形式。这几个的字段的含义分别是: $share 前缀表明这将是一个共享订阅 {ShareName} 是一个不包含 "/", "+" 以及 "#" 的字符串。订阅会话通过使用相同的 {ShareName} 表示共享同一个订阅,匹配该订阅的消息每次只会发布给其中一个会话 {filter} 即非共享订阅中的主题过滤器 需要注意的是

MQTT with load balanced applicaiton server

喜你入骨 提交于 2019-12-04 06:09:54
问题 I am having two tomcat servers running same web application. Both the web applications subscribe to topic 1 in MQTT server. Whenever message is received in topic 1 both the applications receive the message. But I want only one server to process the request instead of both. The worst case I have to do condition check at both the web applications to allow one time processing. Any suggestions for this case ? 回答1: You need to use a MQTT broker that supports Shared Subscriptions 1 This feature

How do I convert from a Json Byte Array for AMQP in Spring Boot?

牧云@^-^@ 提交于 2019-12-04 06:04:12
问题 Following this, I have this code @Bean open fun messageConverter(om: ObjectMapper): MessageConverter { return Jackson2JsonMessageConverter(om) } @Bean open fun rabbitListenerContainerFactory(cf: ConnectionFactory, mc: MessageConverter ): SimpleRabbitListenerContainerFactory { val factory = SimpleRabbitListenerContainerFactory() factory.setConnectionFactory(cf) factory.setMessageConverter(mc) return factory } @Bean open fun builder(): Jackson2ObjectMapperBuilderCustomizer { return

Paho Mqtt Android connecting to broker fails with (32103)

穿精又带淫゛_ 提交于 2019-12-04 05:45:12
问题 I have an ActiveMQ broker in my network listening on 1883 (mqtt). If I connect to that broker using a simple Java application and the mqtt-client-0.4.0.jar library everything works. Now I want to connect to that broker with an Android device. Unfortunately I just can't manage it to get a successful connection. I'm always getting the following error: 03-23 11:08:15.679 24572-24572/com.my.package E/WorkerMQTT: onFailure: Unable to connect to server (32103) - java.net.ConnectException: failed to

Java Eclipse Paho Implementation - Auto reconnect

痴心易碎 提交于 2019-12-04 04:50:51
I'm trying to implement eclipse.paho in my project to connect Mqtt Broker (Both subscribing and publishing purpose). The problem is, when I using the subscribing feature (Implementing MqttCallback interface), I couldn't figure our how can I reconnect if the connection lost. MqttCallback interface has a connectionLost method, but it is useful for the debug what causes the connection lost. I searched but couldn't find a way to establish auto reconnect. Can you suggest a way or document about this problem? The best way to do this is to structure your connection logic so it lives in a method on it

How to run mosquitto mqtt broker on openshift online

喜你入骨 提交于 2019-12-04 02:24:00
问题 Has anybody successfully run mosquitto on the openshift online version in a free account? There are two SO questions relevant but not really solve all the questions: "How to connect to my MQTT Broker in Openshift". It runs JBoss Fuse and needs either the SNI feature on the server or the port-forwarding on the client. "How can I access socket through Openshift". The author mentions running mosquitto but there is no details as to how. Stuffs that have been done so far: I have run a python

How to use a self signed certificate to connect to a Mqtt server in Android (paho client)?

纵然是瞬间 提交于 2019-12-03 23:05:32
问题 Im having problem connecting to a mqtt server using self signed certificate. im using Paho client and want to connect to a server using a TLSv1.2 . actually i was successful to connect in Android APIs 20+ but no success for below this version. what ive done till now : 1- created a PKCS#12 keystore and put the .crt file and assing a password to it and save it (it will be a .pfx file) 2- added the .pfx file to raw folder of recourse in android project 3- used below code to load self signed

Suitable protocol for Instant Messaging

馋奶兔 提交于 2019-12-03 21:02:08
问题 We have to develop a native mobile app for Instant Messaging using a SUITABLE protocol. Also we are to develop a website for that application so that those who cannot login to mobile can continue their Instant Messaging through the website. Later on, we would be adding the facilities of voice and video calls to the both native mobile app as well as the website. Now my question is that, based on the above situation, which protocol we should go with? I did some research on the internet about