EMQX 是一款大规模可弹性伸缩的云原生分布式物联网 MQTT 消息服务器。
emqx中文开发文档
EMQX配置以及Android连接_往事随风,浮生若梦的博客-CSDN博客
Android studied基于MQTT连接本地EMQX建立的MQTT服务器--下载jar包
emqx环境搭建-客户端接入
下载 EMQX | EMQ-官方 下载与安装
centos7安装emqx4.4.5失败,提示require openssl11 - EMQX - EMQ 问答社区 (askemq.com)
EMQX的使用_long yongtu的博客-CSDN博客_emqx使用 -客户端测试MQTT.fx (订阅和发布消息)
EMQ-代理订阅 概述和应用 使用内置模块实现静态代理_小哇666的博客-CSDN博客_emq代理
安装后 访问 :http://192.168.3.54:18083/ 用户名开始都是admin 密码默认为:pubilc 。接下来我们将会进入下面的界面
emqx控制台MQTTX5.0客户端
登录可以有后台控制自动订阅
MQTT X:跨平台 MQTT 5.0 桌面客户端工具
mqtt.fx-1.7.1--客户端不推荐版本高要授权(账号登陆不是实现自动订阅)
mqtt.fxemqx springboot接入
emqx通常需要提供参数
const broker = "118.178.***.**"
const port = 1883
const client_id = "w_client_my_01"
const username = "user01"
const password = "aaaaabbb********************"
const topic = "$share/gsfriend/scrm/m2s/msg/1/#"
导入包
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.2</version>
</dependency>
OnMessageCallback.java
package cn.stylefeng.guns.test_emqx;
import org.eclipse.paho.client.mqttv3.*;
public class OnMessageCallback implements MqttCallback {
public void connectionLost(Throwable cause) {
// 连接丢失后,一般在这里面进行重连
System.out.println("连接断开,可以做重连");
}
public void messageArrived(String topic, MqttMessage message) throws Exception {
// subscribe后得到的消息会执行到这里面
System.out.println("接收消息主题:" + topic);
System.out.println("接收消息:" + new String(message.getPayload()));
}
public void deliveryComplete(IMqttDeliveryToken token) {
System.out.println("deliveryComplete---------" + token.isComplete());
}
}
TestEMQX.java
package cn.stylefeng.guns.test_emqx;
import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
public class TestEMQX {
public static void main(String[] args) {
String username = "user01";
String passWord = "aaaaabbb********************";
int qos = 0;
String broker = "tcp://118.178.***.**:1883";
String clientId = "w_client_my_01";
MemoryPersistence persistence = new MemoryPersistence();
try {
MqttClient client = new MqttClient(broker, clientId, persistence);
// MQTT 连接选项
MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setUserName(username);
connOpts.setPassword(passWord.toCharArray());
// 保留会话
connOpts.setCleanSession(true);
// 设置回调
client.setCallback(new OnMessageCallback());
// 建立连接
System.out.println("Connecting to broker: " + broker);
client.connect(connOpts);
System.out.println("Connected");
} catch (MqttException me) {
System.out.println("reason " + me.getReasonCode());
System.out.println("msg " + me.getMessage());
System.out.println("loc " + me.getLocalizedMessage());
System.out.println("cause " + me.getCause());
System.out.println("excep " + me);
me.printStackTrace();
}
}}
emqx插件
[root@localhost ~]# l ls /etc/emqx/plugins/
acl.conf.paho emqx_auth_pgsql.conf emqx_lua_hook.conf emqx_rule_engine.conf
emqx_auth_http.conf emqx_auth_redis.conf emqx_lwm2m.conf emqx_sasl.conf
emqx_auth_jwt.conf emqx_bridge_mqtt.conf emqx_management.conf emqx_sn.conf
emqx_auth_ldap.conf emqx_coap.conf emqx_prometheus.conf emqx_stomp.conf
emqx_auth_mnesia.conf emqx_dashboard.conf emqx_psk_file.conf emqx_telemetry.conf
emqx_auth_mongo.conf emqx_exhook.conf emqx_recon.conf emqx_web_hook.conf
emqx_auth_mysql.conf emqx_exproto.conf emqx_retainer.conf
EMQX 认证鉴权(一)——基于 MySQL 的 MQTT 连接认证 | EMQ
EMQX-plugin 认证之mysql保存数据到 MySQL
保存数据到 MySQL | EMQX 企业版 4.3 文档
看文档即可
EMQX webhook实现转发消息到java web服务器并保存到MySQL数据库
网友评论