mqtt基础功能
parent
8c2eebbf55
commit
814cad45cd
|
|
@ -196,7 +196,7 @@ public class MqttMessageHandler implements SmartLifecycle {
|
|||
private void handleMessage(String topic, String payload) {
|
||||
try {
|
||||
// 优化:替换System.out为log.info
|
||||
log.info("【MQTT接收】topic={}, payload={}", topic, payload);
|
||||
// log.info("【MQTT接收】topic={}, payload={}", topic, payload);
|
||||
|
||||
// 设备状态主题:dtu/{deviceId}/up
|
||||
if (topic.matches("dtu/\\w+/up")) {
|
||||
|
|
@ -272,11 +272,11 @@ public class MqttMessageHandler implements SmartLifecycle {
|
|||
// 发布消息
|
||||
mqttMessageSender.publish(frontendTopic, payload);
|
||||
// 优化:替换System.out为log.info
|
||||
log.info("【设备状态转发】设备{} → 前端{},主题:{}", deviceId, clientId, frontendTopic);
|
||||
// log.info("【设备状态转发】设备{} → 前端{},主题:{}", deviceId, clientId, frontendTopic);
|
||||
}
|
||||
} else {
|
||||
// 优化:替换System.out为log.info
|
||||
log.info("【设备状态转发】设备{}无订阅前端,跳过转发", deviceId);
|
||||
// log.info("【设备状态转发】设备{}无订阅前端,跳过转发", deviceId);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue