From 6a24755c21e5ae90ddf30025680a0098479aad21 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期三, 15 十一月 2023 10:38:57 +0800
Subject: [PATCH] mq创建连接
---
ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttOnce.java | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttOnce.java b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttOnce.java
index cb797b1..db5af35 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttOnce.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttOnce.java
@@ -87,6 +87,7 @@
public String publishCar(String carId,String topic,String message,String type) throws MqttException {
MqttClient client = getMqttClient(carId);
MqttConnectOptions options = getMqttConnectOptions();
+ client.connect(options);
MqttMessage msg = new MqttMessage(message.getBytes());
msg.setQos(2);
client.publish(topic,msg);
--
Gitblit v1.9.3