|
|
@@ -1,5 +1,6 @@
|
|
|
package com.yunfeiyun.agmp.iots.core.mqtt.network;
|
|
|
|
|
|
+import com.yunfeiyun.agmp.common.utils.ip.IpUtils;
|
|
|
import com.yunfeiyun.agmp.iots.core.mqtt.modal.MqttTopicValue;
|
|
|
import com.yunfeiyun.agmp.iots.device.common.Device;
|
|
|
import lombok.Getter;
|
|
|
@@ -132,7 +133,6 @@ public class MqttCore {
|
|
|
log.info("【初始化】MQTT CORE {},{},{},{},{},", mqttConfig.getDeviceType(), mqttConfig.getIp(), mqttConfig.getPort(), mqttConfig.getUsername(), mqttConfig.getPassword());
|
|
|
this.mqttConfig = mqttConfig;
|
|
|
buildClient();
|
|
|
-
|
|
|
buildPublisher();
|
|
|
buildSubscriber();
|
|
|
connection();
|
|
|
@@ -146,8 +146,8 @@ public class MqttCore {
|
|
|
private void buildClient() throws MqttException {
|
|
|
//return new MqttClient("tcp://47.96.123.180:1883", UUID.randomUUID().toString().replace("-",""));
|
|
|
String url = "tcp://" + mqttConfig.getIp() + ":" + mqttConfig.getPort();
|
|
|
- this.mqttClient = new MqttClient(url, connectionId, new MemoryPersistence());
|
|
|
- log.info("【初始化】构建 MQTT client {}", this.mqttClient);
|
|
|
+ this.mqttClient = new MqttClient(url, connectionId+ IpUtils.getHostIp(), new MemoryPersistence());
|
|
|
+ log.info("【初始化】构建 MQTT clientId {}", this.mqttClient.getClientId());
|
|
|
}
|
|
|
|
|
|
/**
|